eclipse怎么连接mysql数据库
如题目
多谢!!
private String strDriver="com.mysql.jdbc.Driver";
private String strUrl="jdbc:mysql://localhost:3306/***";
private String strUser="***";
private String strPwd="***";
private Connection conn;
try{
Class.forName(strDriver);
}catch(ClassNotFoundException ex){
System.err.println(ex.getMessage);
}
try{
conn=DriverManager.getConnection(strUrl,strUser,strPwd);
}catch(SQLException e){
System.out.println("Conn err"+e.getMessage);
}
粗略的写了下 错了还请更正.
Thanks!