将myeclipse和mysql连接起来的关键语句

Posted jun俊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将myeclipse和mysql连接起来的关键语句相关的知识,希望对你有一定的参考价值。

 1       String driverName="com.mysql.jdbc.Driver";
 2       String userName="root";
 3       String userPwd="123456";
 4       String dbName="students";
 5       String url1="jdbc:mysql://localhost:3306/"+dbName;
 6       String url2="?user="+userName+"&password="+userPwd;
 7       String url3="&useUnicode=true&characterEncoding=UTF-8";
 8       String url=url1+url2+url3;
 9       Class.forName(driverName);
10       Connection conn=DriverManager.getConnection(url);

 

以上是关于将myeclipse和mysql连接起来的关键语句的主要内容,如果未能解决你的问题,请参考以下文章