public String connMySQLDateBase(String ip , String prot , String datebase ,
String username , String password){
try {
String driverName="org.gjt.mm.mysql.Driver"
String url="jdbc:mysql://"+ip+":"+prot+"/"+datebase
Class.forName(driverName)
System.out.println("load driver success")
DriverManager.getConnection(url,username,password)
return "恭喜,连接MySQL数据库成功!"
} catch (Exception e) {
return "连接出现异常"
}
}
java代码:Class.forName("com.mysql.jdbc.Driver")Connectioncon=DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=root&password=111111")Stringsql="{callsel(?)}"CallableStatementcs=(CallableStatem欢迎分享,转载请注明来源:内存溢出
评论列表(0条)