我一直在想:
线程"awt-eventqueue-0"局部异常堆栈中的异常:异常 [TOPLINK-4002] ( Oracle TopLink Essentials - 2.0.1 ( 生成 b09d-fcs ( 12/06/2007 ) ) )oracle.toplink.essentials.exceptions.DatabaseException 内部异常:java.sql. sql Exception:用户'root'@'localhost'的访问拒绝( 使用密码:是)
但是我的项目代码连接信息和MySQL数据库有相同的信息- 因此我是suppliying正确的登录信息。为什么它总是说我的密码错了。我在本地主机,我的用户名是 root,没有密码。
下面是我使用的项目变量的代码:
static final String host ="jdbc:mysql://localhost:3306/myDb";
static final String uName ="root";
static final String uPass ="";
static final String query ="SELECT * FROM customers";
...
Connection con = DriverManager.getConnection( host, uName, uPass );