调试总是出错,请名师指点!!急在线等待(30分)

Y

yj3385

Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
import java.sql.*;
class first_ext
{
public static void main(String[] args)
{
String queryString = "select * from Customers";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection myConn = DriverManager.getConnection("jdbc:eek:dbc:first_exp","sa","45454");
Statement myStmt = myConn.createStatement();
ResultSet myResults = myStmt.executeQuery(queryString);
System.out.println("Hello World!");
}
}
出错信息---------------------------------------
D:/aa/java/exp/first_exp.java:10: unreported exception java.lang.ClassNotFoundException;
must be caught or declared to be thrown
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
D:/aa/java/exp/first_exp.java:11: unreported exception java.sql.SQLException;
must be caught or declared to be thrown
Connection myConn = DriverManager.getConnection("jdbc:eek:dbc:first_exp","sa","45454");
 
G

goldbaby

Unregistered / Unconfirmed
GUEST, unregistred user!
要求你捕捉异常:如public boolean disconnect() throws SQLException {
.....
try {}
catch(Exception e)
{
}
 
Y

yj3385

Unregistered / Unconfirmed
GUEST, unregistred user!
顶部