jdbc简单源码
代码说明:
//登记JDBC驱动程序 Class.forName ( "org.gjt.mm.mysql.Driver" ).newInstance ( ); //连接参数与Access不同 String url = "jdbc:mysql://localhost/LearnJSP"; //建立连接 Connection connection = DriverManager.getConnection ( url, "root", "011124" ); //SQL语句 String sql = "select * from userinfo where username="" + sUserName + "" and userpwd = "" + sPasswd + """; Statement stmt = connection.createStatement ( ); ResultSet rs = stmt.executeQuery ( sql ); //返回查询结果
下载说明:请别用迅雷下载,失败请重下,重下不扣分!