简体   繁体   English

java.sql.SQLException:sun.jdbc.odbc.JdbcOdbc.createSQLException 的一般错误(未知来源)

[英]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.

相关问题 java.sql.SQLException:常规错误 - java.sql.SQLException:General error SQL语句未执行! java.sql.SQLException:一般错误 - SQL statement is not executed! java.sql.SQLException: General error 即使插入成功,“ java.sql.SQLException:常规错误” - “java.sql.SQLException: General error” even if the insert worked 获取时间戳结果为java.sql.SQLException:一般错误 - Getting Timestamp results in java.sql.SQLException: General error 错误:java.sql.SQLException:未找到适合jdbc:sqlserver的驱动程序 - Error: java.sql.SQLException: No suitable driver found for jdbc:sqlserver JDBC SQL Server错误:java.sql.SQLException:没有合适的驱动程序 - jdbc sql server error: java.sql.SQLException: No suitable driver JDBC-ODBC SQLException:常规错误 - JDBC-ODBC SQLException:General Error 无法连接到数据库错误:java.sql.SQLException:[Microsoft] [ODBC驱动程序管理器]找不到数据源名称并且未指定默认驱动程序 - Cannot connect to database Error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified java.sql.SQLException:找不到-JDBC - java.sql.SQLException: not found - JDBC java.sql.SQLException:[Microsoft] [ODBC驱动程序管理器]找不到数据源名称,也没有默认驱动程序 - java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM