1.错误信息
$ sudo java -cp .:lib/postgresql-9.1-903.jdbc4.jar zetcode/Version
Nov 12, 2012 12:27:12 AM zetcode.Version main
SEVERE: FATAL: password authentication failed for user "user12"
org.postgresql.util.PSQLException: FATAL: password authentication failed for user "user12"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:291)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:106)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:123)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:28)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:20)
at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:30)
at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:22)
at org.postgresql.Driver.makeConnection(Driver.java:391)
at org.postgresql.Driver.connect(Driver.java:265)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at zetcode.Version.main(Version.java:25)
2.解决方法
# sudo -u postgres psql
postgres=# ALTER USER user12 WITH PASSWORD 'user12';
postgres参考:http://blog.chinaunix.net/uid-25885064-id-3404550.html
3.结果
$ sudo java -cp .:lib/postgresql-9.1-903.jdbc4.jar zetcode/Version
[sudo] password for txgcwm:
PostgreSQL 9.1.6 on i686-pc-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2, 32-bit
阅读(4384) | 评论(0) | 转发(2) |