java 知识点总结 --java解析.mdb文件的表名
2009-11-03 20:57:48 来源:WEB开发网核心提示://java解析.mdb文件的表名集合 this.tableList.clear();conn = null;st = null;rs = null;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");String url ="jdbc:odbc:d
//java解析.mdb文件的表名集合
this.tableList.clear();
conn = null;
st = null;
rs = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url ="jdbc:odbc:driver={Microsoft access Driver (*.mdb)};DBQ="+dbName;//此为NO-DSN方式
//System.out.PRintln("mdb文件路径:"+dbName);
conn=DriverManager.getConnection(url);
conn.setCatalog(dbName);
ResultSet tables = conn.getMetaData()
.getTables(dbName,null,null,new String[]{"TABLE"});
while(tables.next()){
String str = tables.getString(3);//getXXX can only be used once here
tableList.add(str);
}
this.tableList.clear();
conn = null;
st = null;
rs = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url ="jdbc:odbc:driver={Microsoft access Driver (*.mdb)};DBQ="+dbName;//此为NO-DSN方式
//System.out.PRintln("mdb文件路径:"+dbName);
conn=DriverManager.getConnection(url);
conn.setCatalog(dbName);
ResultSet tables = conn.getMetaData()
.getTables(dbName,null,null,new String[]{"TABLE"});
while(tables.next()){
String str = tables.getString(3);//getXXX can only be used once here
tableList.add(str);
}
更多精彩
赞助商链接