import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class DBaccess {
public static void main(String args[]) throws Exception{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String dburl ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\\DBTest.mdb";//此为NO-DSN方式
Connection conn=DriverManager.getConnection(dburl);
Statement stmt=conn.createStatement();
DatabaseMetaData dbmd=conn.getMetaData();
ResultSet rs=dbmd.getTables(null,null,"%",null);
while(rs.next()){
System.out.println("table-name: "+rs.getString(3)+"
");
}
stmt.close();
conn.close();
}
}