“[Microsoft] [ODBC Driver Manager]无效的字符串或缓冲区长度”错误 [英] "[Microsoft][ODBC Driver Manager] Invalid string or buffer length" error
本文介绍了“[Microsoft] [ODBC Driver Manager]无效的字符串或缓冲区长度”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[Microsoft] [ODBC驱动程序管理器]无效的字符串或缓冲区长度
。如何解决这个问题? 这是我的代码:
public static Connection getConnection(){
try
{
Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
String url =jdbc:odbc:cabrouterds;
con = DriverManager.getConnection(url,,);
}
catch(Exception e)
{
System.out.println(SQL Connection Exception:+ e.getMessage());
}
return con;
}
解决方案
我不知道为什么它没有工作。可能的猜测是64位Windows 7和32位MySQL连接器ODBC之间的兼容性问题。使用JDBC - MySQL连接器。现在它有效。
When I run in eclipse it runs fine. But, through the command prompt, it throws the exception "[Microsoft][ODBC Driver Manager] Invalid string or buffer length"
. How to get over this?
This is my code:
public static Connection getConnection(){
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:cabrouterds";
con = DriverManager.getConnection(url, "", "");
}
catch(Exception e)
{
System.out.println("SQL Connection Exception: "+e.getMessage());
}
return con;
}
解决方案
I'm not sure why it didn't work. Probable guess would be compatibility issues between 64 bit windows 7 and 32 bit MySQL Connector ODBC. Used JDBC - MySQL connector. Now it works.
这篇关于“[Microsoft] [ODBC Driver Manager]无效的字符串或缓冲区长度”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文