写了一个类,来测试链接MySQL:// JDBC 驱动名及数据库 URLstatic final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/dbx?useSSL=false";
static final String USER = "root";static final String PASS = "123456";
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
// 注册 JDBC 驱动
Class.forName("com.mysql.jdbc.Driver"); // 打开链接
System.out.println("连接数据库...");
conn = DriverManager.getConnection(DB_URL,USER,PASS);//就在这一行出错了
...
}报错内容:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server求大神路过瞄一眼指点下什么问题
添加回答
举报
0/150
提交
取消