您好我正在使用jdbc無法連接到sybase數據庫的問題。我也把jconn.jar依賴於intellij 12.1。無法使用JDBC連接到Syabse數據庫
我收到以下錯誤時拋出
值java.sql.SQLException:找到了JDBC沒有合適的驅動程序:JTDS:SYBASE:some.com:8000/DBAQ02 在java.sql.DriverManager.getConnection( DriverManager.java:604) 在java.sql.DriverManager.getConnection(DriverManager.java:221) 在gbconnect.DBConnectPOC.main(DBConnectPOC.java:81) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本機方法) 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invok e(DelegatingMethodAccessorImpl.java:43) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
請參閱以下代碼。請指導我真的很生氣。提前致謝。
try
{
Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
}
catch (ClassNotFoundException e)
{
throw new IllegalArgumentException(
"Driver class '" + driverClassName + "' is not valid.", e);
}
}
//jdbc:jtds:sybase://some.com:8000/DBAQ02
Statement stmt = null;
Connection conn = null;
try
{
System.out.println(driverClassName + "://" + url);
conn = DriverManager.getConnection("jdbc:jtds:sybase:some.com:8000/DBAQ02","sa","abc");
stmt = conn.createStatement();
stmt.executeUpdate(SQL_CREATE);
System.out.println("Created table in given database...");
}
你用什麼驅動? – MaVRoSCy