您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jdbc- 连接mysql老是出现连接失败?

2024/3/11 10:29:24发布21次查看
mysqljdbcjava
新建的java工程,测试代码如下,已经把驱动程序拷贝到jre system liabrary 中
package com.test.tao;
import java.sql.*;
public class test {
public static void main(string args[])
{
try{
class.forname(com.mysql.jdbc.driver);
system.out.print(加载数据库成功);
string str=jdbc:mysql://localhost:3306/test?+user=root&password=123456;
connection conn=drivermanager.getconnection(str);
system.out.print(连接成功);
}
catch (exception e)
{system.out.print(连接失败);}
}
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product