Thread: Failure to connect remotely to postgresql with JDBC
Hi, I am using Postgresql 6.3.2 running on a Sun Solaris. The interface I am using is JDBC. When I connect, I received the following error messages: 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 ConLayer.Select(ConLayer.java:149) at ConLayerTest.main(ConLayerTest.java:82) java.lang.NullPointerException at ConLayer.Select(ConLayer.java:165) at ConLayerTest.main(ConLayerTest.java:82) The url is: jdbc:postgresql://holly.cs.mu.oz.au:5432/conlayer?user=me&password=abc& auth=password conlayer is the database name. That is, the server is holly.cs.mu.oz.au and the port is 5432. postmaster is definitely running on holly. The environment variables PGHOST has been set to holly.cs.mu.oz.au and PGPORT has been set to 5432. PGLIB and PGDATA has also been set correctly. The pg_hba.conf has been set to accept all users from anywhere but this doesn't helps. Can someone please help? Thanks in advance Kelvin ------------------------------------------------------------------------------ When you are stuck at work, think of this: "Do not worry about your mathematics difficulties. I can assure you that mine are still greater." - Einstein ------------------------------------------------------------------------------ Kelvin Sin University of Melbourne BSc (Mathematics) / BE (Software) undergraduate Project homepage: http://www.cs.mu.oz.au/SE-projects/440-team Personal homepage: http://www.ecr.mu.oz.au/~ksin Email: ksin@ecr.mu.oz.au ksin@students.cs.mu.oz.au ------------------------------------------------------------------------------
On Thu, 30 Jul 1998, Kelvin SIN wrote: > Hi, > > I am using Postgresql 6.3.2 running on a Sun Solaris. The interface I am > using is JDBC. > > When I connect, I received the following error messages: [snip] > The url is: > > jdbc:postgresql://holly.cs.mu.oz.au:5432/conlayer?user=me&password=abc& > auth=password First, the auth=password is no longer used. Since 6.3, the network protocol changed, and the client and server now negociate the authentication scheme to use (based on pb_hba.conf). Also, remember that postgresql users are not the same as unix users. Unless you have used pg_password to create a password file, then use the "ALTER USER" sql statement to set a password in the database. > conlayer is the database name. > > That is, the server is holly.cs.mu.oz.au and the port is 5432. postmaster > is definitely running on holly. The environment variables PGHOST has been > set to holly.cs.mu.oz.au and PGPORT has been set to 5432. PGLIB and > PGDATA has also been set correctly. The pg_hba.conf has been set to accept > all users from anywhere but this doesn't helps. Can someone please help? Is the client holly aswell? Do you have the pg_hba.conf file configured to allow the client's IP address access? Even if they are the same machine, if you specify the host name, rather name localhost, then you'll need to add the server's IP address into the file aswell as 127.0.0.1 -- Peter T Mount peter@retep.org.uk or petermount@earthling.net Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Hi Peter, According to the JDBC documentation from java.sun.com, a JDBC driver is JDBC compliant if it is SQL 92 complaint and passes the JDBC compliance test. I think Postgresql is a subset of SQL92, but is it still JDBC compliant? I am working in a client server project that connects to postgresql and I need to find out how many of the JDBC APIs can be used, especially the getCursor() method under the Connection class. Thanks. Kelvin
On Thu, 6 Aug 1998, Kelvin SIN wrote: > Hi Peter, > > According to the JDBC documentation from java.sun.com, a JDBC driver is > JDBC compliant if it is SQL 92 complaint and passes the JDBC compliance > test. I think Postgresql is a subset of SQL92, but is it still JDBC > compliant? It isn't yet for two reasons: 1) CallableStatement is not implemented at all yet 2) I'm not sure if it would be compliant as we only support a subset of SQL92. > I am working in a client server project that connects to > postgresql and I need to find out how many of the JDBC APIs can be used, > especially the getCursor() method under the Connection class. Thanks. Currently getCursor() simply returns the string passed to the Connection by the setCursor() method. I think that (in JDBC) cursors need looking into. -- Peter T Mount peter@retep.org.uk or petermount@earthling.net Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres