String strurl = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D:/yunnan/db1.mdb";// ACCESS文件位置
// String strurl = "jdbc:odbc:access";// ACCESS文件位置
Connection
ResultSet
DatabaseMetaData dbMeta
拿列:dbMeta.getColumns
列名:rs.getString("COLUMN_NAME")
字段类型:rs.getInt("DATA_TYPE")
拿主键:dbMeta.getPrimaryKeys
拿Schema: dbMeta.getSchemas
rs.getString("TABLE_SCHEM")
MYSQL: 执行select SCHEMA()语句获得
拿表:
rs = dbMeta.getTables(cn.getCatalog(), schema, "%",
new String[] { "TABLE" });
rs.getString("TABLE_NAME");
dbMeta.getImportedKeys
dbMeta.getExportedKeys
rs.getString("PKTABLE_NAME")
DataSource javax