Received: from relay.ripco.com (relay.ripco.com [209.100.227.3]) by hub.org (8.9.2/8.9.1) with SMTP id WAA25347 for ; Fri, 5 Feb 1999 22:44:15 -0500 (EST) (envelope-from bvonmoss@bigfoot.com) Received: (qmail 18682 invoked from network); 6 Feb 1999 03:44:36 -0000 Received: from ip2-124.dynip.ripco.net (HELO bigfoot.com) (209.100.229.124) by relay.ripco.com with SMTP; 6 Feb 1999 03:44:36 -0000 Message-ID: <36BBBA90.67C72C26@bigfoot.com> Date: Fri, 05 Feb 1999 21:44:16 -0600 From: Bob VonMoss X-Mailer: Mozilla 4.5 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: connecting: unix socket? Yes. TCPIP port? No. -i? Yes. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm just getting into PostGreSQL and would ultimately like to communicate from a java/JDBC applet through the web with PostGreSQL on a Solaris unix system. I've had a user account created for me. I'm able to do everything so far from the commandline through unix sockets by running 'psql' and 'createdb mydb'. I began experimenting with JDBC and was having problems connecting, so I put the java application on the same system where PostGreSQL is and was getting the same 'user authentication failed...' messages. I then tried altering the jdbc URL to specify the database only without the internet host name and it worked successfully. I changed this statement in the code below: con = DriverManager.getConnection( "jdbc:postgresql://my-isp.com/mydb","mylogin","mypwd"); to (since I was local): con = DriverManager.getConnection( "jdbc:postgresql:mydb","mylogin","mypwd"); and it worked on the local machine. The error was: bash$ java pCon registering postgresql.Driver... connecting to the PostGreSQL DB... java.sql.SQLException: User authentication failed bash$ I noticed in the docs that you can channel psql through TCPIP ports rather than unix sockets. I tried it (with my real names) and get this: bash$ psql -h my-isp.com -d mydb Connection to database 'mydb' failed. User authentication failedbash$ bash$ psql -h my-isp.com -p 5432 -d mydb Connection to database 'mydb' failed. User authentication failedbash$ I also tried setting PGHOST to my-isp.com, which responded the same. The administrator says this is how postmaster is invoked: /usr/local/pgsql/bin/postmaster -S -i -D /usr/local/pgsql/data -p 5432 // pCon.java import java.io.*; import java.sql.*; public class pCon { public pCon() { } public static void main(String[] args) throws Exception { System.out.println("registering postgresql.Driver..."); Connection con; try { Class.forName("postgresql.Driver"); } catch (Exception e) { System.out.println(""+e); return; } System.out.println("connecting to the PostGreSQL DB..."); try { con = DriverManager.getConnection( "jdbc:postgresql://my-isp.com/mydb","mylogin","mypwd"); } catch (SQLException se) { System.out.println(""+se); return; } System.out.println( "closing connection to the PostGreSQL DB..."); try { con.close(); } catch (SQLException se) { System.out.println(""+se); } System.out.println( "connection to the PostGreSQL DB closed successfully"); } } -- Bob VonMoss mailto:bvonmoss@bigfoot.com from Chicago, IL