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("jdbcdbc: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("jdbcdbc:first_exp","sa","45454");
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("jdbcdbc: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("jdbcdbc:first_exp","sa","45454");