换了电脑问题一个接一个,程序在以前电脑上米问题,现在运行时就报错:
[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序String JDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String conURL = "jdbc:odbc:LyricsInfo";
try{
Class.forName(JDriver);
}catch(ClassNotFoundException e){
Err += "驱动注册失败:"+e.toString();
}try{
Connection con = DriverManager.getConnection(conURL);
Statement s = con.createStatement();
……
}catch (SQLException e){
Err += "SQLException:"+e.toString();
} 但是我明明在ODBC数据源管理器里加了数据源LyricsInfo啊,它就是找不到!!
会不会和SP2的系统有关?
[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序String JDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String conURL = "jdbc:odbc:LyricsInfo";
try{
Class.forName(JDriver);
}catch(ClassNotFoundException e){
Err += "驱动注册失败:"+e.toString();
}try{
Connection con = DriverManager.getConnection(conURL);
Statement s = con.createStatement();
……
}catch (SQLException e){
Err += "SQLException:"+e.toString();
} 但是我明明在ODBC数据源管理器里加了数据源LyricsInfo啊,它就是找不到!!
会不会和SP2的系统有关?
经过检测问题就在
//String conURL = "jdbc:odbc:LyricsInfo";
Connection con = DriverManager.getConnection(conURL);
这句上面,和他提示的 "未发现数据源名称并且未指定默认驱动程序"一样
可是我的数据源明明有啊,请教还有些什么原因会出现这总情况?
但是出问题时是以Tomcat来启动的,但是以前电脑用Tomcat也一切OK,不同的就是Tomcat的版本不同.难道最新版的Tomcat和这会有冲突?
求解决办法,或者告诉我进一步测试的方法!谢谢
如果在SP3以下的话,是联不上的
String dburl ="jdbc:odbc:test";//此为ODBC连接方式
Connection conn=DriverManager.getConnection(dburl);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select Top 200 * from tab");