Обсуждение: newbie to both Java and psql trying jdbc-examples
Hi, Following the directions closely and I still can't get the examples going. Any pointers are extremely helpfull, as I am running out of FAQs. I am trying to run : /usr/src/pgsql/postgresql-6.3.2/src/interfaces/jdbc$ java -Djdbc.driver=postgresql.Driver example.blobtest jdbc:postgresql:mydb mylogin mypassword debug my pg_hba_conf.sample: local all password host all 127.0.0.1 255.255.255.255 password and the result: PostgreSQL blobtest v6.3 rev 1 DriverManager.initialize: jdbc.drivers = null JDBC DriverManager initialized registerDriver: driver[className=postgresql.Driver,context=null,postgresql.Driver@80c81f9] Connecting to Database URL = jdbc:postgresql:mydb DriverManager.getConnection("jdbc:postgresql:mydb") trying driver[className=postgresql.Driver,context=null,postgresql.Driver@80c81f9] -- listing properties -- password=mypassword Protocol=postgresql user=mylogin PGDBNAME=mydb java.sql.SQLException: User authentication failed at postgresql.Connection.<init>(Connection.java:229) at postgresql.Driver.connect(Driver.java:87) at java.sql.DriverManager.getConnection(DriverManager.java:91) at java.sql.DriverManager.getConnection(DriverManager.java:134) at example.blobtest.<init>(blobtest.java:42) at example.blobtest.main(blobtest.java:188) getConnection failed: java.sql.SQLException: User authentication failed Exception caught. java.sql.SQLException: User authentication failed java.sql.SQLException: User authentication failed at postgresql.Connection.<init>(Connection.java:229) at postgresql.Driver.connect(Driver.java:87) at java.sql.DriverManager.getConnection(DriverManager.java:91) at java.sql.DriverManager.getConnection(DriverManager.java:134) at example.blobtest.<init>(blobtest.java:42) at example.blobtest.main(blobtest.java:188)
On Wed, 17 Jun 1998, Lam Nguyen wrote: > Following the directions closely and I still can't get the > examples going. Any pointers are extremely helpfull, as I am running > out of FAQs. I am trying to run : > > /usr/src/pgsql/postgresql-6.3.2/src/interfaces/jdbc$ java > -Djdbc.driver=postgresql.Driver example.blobtest jdbc:postgresql:mydb > mylogin mypassword debug > > my pg_hba_conf.sample: > > local all password > host all 127.0.0.1 255.255.255.255 password Only the host line affects JDBC. Also, you may want to add a host line for your hosts network address as well, like: host all 192.168.1.1 255.255.255.255 password > and the result: > > PostgreSQL blobtest v6.3 rev 1 > > DriverManager.initialize: jdbc.drivers = null > JDBC DriverManager initialized > registerDriver: > driver[className=postgresql.Driver,context=null,postgresql.Driver@80c81f9] > Connecting to Database URL = jdbc:postgresql:mydb > DriverManager.getConnection("jdbc:postgresql:mydb") > trying > driver[className=postgresql.Driver,context=null,postgresql.Driver@80c81f9] > -- listing properties -- > password=mypassword > Protocol=postgresql > user=mylogin > PGDBNAME=mydb > java.sql.SQLException: User authentication failed > at postgresql.Connection.<init>(Connection.java:229) Have you created the user in the database using "create user" ? -- Peter Mount, peter@maidstone.gov.uk Postgres email to peter@taer.maidstone.gov.uk & peter@retep.org.uk Remember, this is my work email, so please CC my home address, as I may not always have time to reply from work.