当然指定了
只是发帖子的时候省略了
public void Run()throws ClassNotFoundException{
//new JdbcOdbcDriver();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Class.forName("com.atinav.access.jdbc2.Driver");
try{ //"jdbc:odbc:Menudb" url = jdbc:microsoft.jdbc.sqlseruver.SQLserver
String url = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ = Menudb.mdb";
Connection throuth =
DriverManager.getConnection(url,"star","470852080");
Statement Stat = throuth.createStatement();
ResultSet result = Stat.executeQuery("select * from GameLoad");
while(result.next()){
//int i=0;
System.out.println("GameNO.: "+result.getString("Game")+"\t"+"路径:"+result.getString("Load"));
//Game[i]=result.getString("Load");i++;
}
result.close();
Stat.close();
}catch(SQLException ce){
//System.out.println("SQLException:"+ce.getMessage());
ce.printStackTrace();
}
}
============================================
eclispse
---------------------------------------------
java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at files.StarMenu.Run(StarMenu.java:99)
at files.StarMenu.main(StarMenu.java:117)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++