Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/test?user=root&password=sa&useUnicode=true&characterEncoding=8859_1" ;
//test为你的数据库名
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from users";
ResultSet rs=stmt.executeQuery(sql);
阅读(1854) | 评论(0) | 转发(0) |