[英]java.sql.SQLException: General error at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
I'm trying to establish a JDBC-ODBC connection using the following routine,我正在尝试使用以下例程建立 JDBC-ODBC 连接,
private static Connection getConnection(String systemDSN, String username, String password) throws Exception {
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:" + systemDSN;
Class.forName(driver);
return DriverManager.getConnection(url, username, password);
}
And here's the complete stack trace I'm getting!这是我得到的完整堆栈跟踪!
java.sql.SQLException: General error at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
Can anyone PLEASE let me know how this is caused and how I can remedy this??!任何人都可以让我知道这是如何引起的以及我该如何解决这个问题??!
Looking for the answer for "general error" I finally found that it is the problem on the data source name.寻找“一般错误”的答案,我终于发现是数据源名称的问题。
jdbc:odbc:xx
where xx
is the data source name NOT the data base name jdbc:odbc:xx
其中xx
是数据源名称而不是数据库名称
It works form me!它对我有用!
Wondering if this could be yet another bitness issue?想知道这是否可能是另一个比特问题?
If this is a 64bit system then the bitness of the Java runtime is important!!!!如果这是一个 64 位系统,那么 Java 运行时的位数很重要!!!!
64bit Java run time will only be able to access 64bit ODBC drivers... 64 位 Java 运行时将只能访问 64 位 ODBC 驱动程序...
32bit Java run time will only be able to access 32bit ODBC drivers... 32 位 Java 运行时将只能访问 32 位 ODBC 驱动程序...
32bit and 64bit ODBC environments are not the same... 32位和64位的ODBC环境不一样...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.