Jsp连接Mysql

String driverName="com.mysql.jdbc.Driver";
String userName="用户名";
String userPwd="密码";
String dbName="数据库名";
String url1="jdbc:mysql://localhost:3306/"+dbName;
String url2="?user="+userName+"&password="+userPwd;
String url3="&useUnicode=true&characterEncoding=UTF-8";
String url=url1+url2+url3;
Class.forName(driverName);
Connection conn=DriverManager.getConnection(url);

posted on 2017-10-16 20:59  3r3r3www  阅读(108)  评论(0编辑  收藏  举报

导航