H
helloqiner
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个极简单的连接数据库的程序,基本上是按书上抄的,可以一编译就报错,大虾们帮我看看:
E:/Java/linkDb/LinkDb.java:40: unreported exception java.lang.ClassNotFoundException;
must be caught or declared to be thrown
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
E:/Java/linkDb/LinkDb.java:42: unreported exception java.sql.SQLException;
must be caught or declared to be thrown
Connection c = DriverManager.getConnection(url, "sa", "");
^
这是那里的问题啊?!!
E:/Java/linkDb/LinkDb.java:40: unreported exception java.lang.ClassNotFoundException;
must be caught or declared to be thrown
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
E:/Java/linkDb/LinkDb.java:42: unreported exception java.sql.SQLException;
must be caught or declared to be thrown
Connection c = DriverManager.getConnection(url, "sa", "");
^
这是那里的问题啊?!!