我通过odbc数据源连接sql server2000 求救!! [code=Java][/code] import java.sql.*; public class sqltexs { public static void main(String[] args) { Connection ct = null; Statement sm = null; try { Class.forName(" sun.jdbc.odbc.JdbcOdbcDriver"); ct = DriverManager.getConnection("jdbc : odbc : mytext","sa","123"); //3.创建Statement,用于发送sql语句. sm = ct.createStatement(); //excunteUpdate()
int counter= sm.executeUpdate("select * from grade"); System.out.println(counter); } catch (Exception e) {
System.out.println("df"); // TODO Auto-generated catch block e.printStackTrace(); } } }
结果: java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at demo.sqltexs.main(sqltexs.java:13)