public static void main(String[] args) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
Connection conn=DriverManager.getConnection("jdbc:odbc:bookshop","","");
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from user");
while(rs.next()){
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
System.out.println(rs.getString(4));
System.out.println(rs.getString(5));
System.out.println(rs.getString(6));
}
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
连接access数据库
最新推荐文章于 2023-06-19 20:22:20 发布