【问题标题】:Why I got java.sql.SQLException while running my system? [duplicate]为什么在运行我的系统时出现 java.sql.SQLException? [复制]
【发布时间】:2021-05-23 12:33:02
【问题描述】:

我在我的程序和 phpMyAdmin 中的数据库之间建立了连接, 这是连接方法:

public Connection getConnection() throws SQLException{
    Connection con=null;
    con=DriverManager.getConnection("jdbc:mysql://localhost/testdb"," 
 ","");
    return con;
}

我得到了以下异常:

【问题讨论】:

标签: java mysql sql phpmyadmin


【解决方案1】:

异常消息告诉您所有您需要知道的信息:您收到错误的原因是因为不允许您使用的凭据(用户名和密码)访问您尝试连接的数据库。

您需要先登录数据库并使用这些凭据授予访问权限。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 2018-09-11
    • 1970-01-01
    • 2022-06-15
    • 2012-03-30
    • 2020-05-07
    • 2010-09-05
    相关资源
    最近更新 更多