我能够创建一个java.sql.Connection对象并获取表数据:
DatabaseMetaData metaData = connection.getMetaData();
String [] tableTypes = {"Table"};
ResultSet rs = metaData.getTables(null, null, null, tableTypes);
if (rs != null) {
while (rs.next()) {
String tableName = rs.getString("TABLE_NAME");
// Do some further table analysis
}
}
如何获取mdb文件中保存的查询? (具体来说,它们的名称,以及它们的SQL语句)
谢谢!
答案 0 :(得分:2)
使用Jackcess:
Database db = DatabaseBuilder.open(new File("access.mdb"));
for (Query query : db.getQueries()) {
System.out.println(query.getName() + ": " + query.toSQLString());
}