1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url ="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=C:/temp/thebase.mdb";
Connection connection = DriverManager.getConnection(url, "", "");
Statement statement = connection.createStatement();
ResultSet resultset =statement.executeQuery("select * from MonCode");
resultset.close();
statement.close();
connection.close();
}
catch (ClassNotFoundException e1) {
e1.printStackTrace(); }
catch (SQLException e1) {
e1.printStackTrace(); }
}; |
Partager