当前位置: 技术问答>java相关
难道数据库不支持这个功能 ? 谢谢!
来源: 互联网 发布时间:2015-04-29
本文导语: public DBTest(){ try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); url = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=test.mdb"; connection = DriverManager.getConnection(url, "", ""); DatabaseMetaData md = connect...
public DBTest(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
url = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=test.mdb";
connection = DriverManager.getConnection(url, "", "");
DatabaseMetaData md = connection.getMetaData();
ResultSet rs = md.getTables("","","%",null);
while(rs.next())
System.out.println(rs.getString(3));
}catch(Exception e){ System.out.println(e.toString()); }
}
不能得到预期结果!!怎么回事!报错如下:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]可选的功能未实现
难道是Access不支持这个功能?
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
url = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=test.mdb";
connection = DriverManager.getConnection(url, "", "");
DatabaseMetaData md = connection.getMetaData();
ResultSet rs = md.getTables("","","%",null);
while(rs.next())
System.out.println(rs.getString(3));
}catch(Exception e){ System.out.println(e.toString()); }
}
不能得到预期结果!!怎么回事!报错如下:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]可选的功能未实现
难道是Access不支持这个功能?
|
public void DBTest(){
Connection con ;
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:;DRIVER=Microsoft Access Drive(*.mdb);DBQ=c:..test.mdb";
try{
Class.forName(driver);
con = DriverManager.getConnection(url);
DatabaseMetaData dmd = con.getMetaData();
Statement st = con.createStatement();
ResultSet res = getTables("","","%",null);
while(res.next()){
}
res.close();
}
catch(Exception e){
e.printStackTrace ();
}
}
Connection con ;
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:;DRIVER=Microsoft Access Drive(*.mdb);DBQ=c:..test.mdb";
try{
Class.forName(driver);
con = DriverManager.getConnection(url);
DatabaseMetaData dmd = con.getMetaData();
Statement st = con.createStatement();
ResultSet res = getTables("","","%",null);
while(res.next()){
}
res.close();
}
catch(Exception e){
e.printStackTrace ();
}
}