尝试与SQL数据库建立ODBC连接时,我在Java 1.7中收到以下异常。我已经在网上搜索了一个解决方案,但我只能在没有任何Java解决方案的情况下找到问题的描述。我的连接字符串如下:
try {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ex) {
Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex);
}
r = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};SERVER=sql4.sqldatabase.com;PORT=3306;DATABASE=sql457564;UID=username;PWD=******");
} catch (SQLException ex) {
System.err.println("Error in connection");
ex.printStackTrace();
}
我收到的例外是:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]TDS buffer length too large
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3072)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
任何帮助将不胜感激! 感谢