java连接access数据库的代码
String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F://ge//123.MDB";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(url);
System.out.println(conn);
Statement sta = conn.createStatement();
ResultSet resu = sta.executeQuery("select * from Roche_position");
if(resu.next()){
System.out.println(resu.getString("cname"));
}
System.out.println("exit");
}catch(Exception e){
e.printStackTrace();
}