我正在尝试从 Java eclipse 连接到 postgreSQL
这是数据库结构的快照。
connection = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432/postgres", "postgres",
"admin");
当我尝试连接到 postgres 数据库时,它工作得非常好。但这是我不想连接的默认数据库。
connection = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432/postgres", "han2012205",
"admin");
当我尝试访问 han2012205 时,它抛出了这个错误。
org.postgresql.util.PSQLException: FATAL: password authentication failed for user "han201205"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:398)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:173)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:393)
at org.postgresql.Driver.connect(Driver.java:267)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at connectToDB.dbConnection.connectdatabase(dbConnection.java:26)
at AdapterTest.main(AdapterTest.java:22)
有人可以帮我解决我的问题吗
希望尽快收到某人的回音!!