X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E9E78DA601 for ; Sat, 8 Oct 2005 05:12:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55227-06 for ; Sat, 8 Oct 2005 08:11:57 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id B99A6D9D12 for ; Sat, 8 Oct 2005 05:11:56 -0300 (ADT) Received: (qmail 30360 invoked from network); 8 Oct 2005 08:11:57 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 8 Oct 2005 08:11:57 -0000 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v734) Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Message-Id: <7802F6D7-4F91-4327-988B-1006EEEADC34@fastcrypt.com> Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: quoted-printable From: Dave Cramer Subject: Re: Still baffled by a CONNECTion problem Date: Sat, 8 Oct 2005 04:11:56 -0400 To: Peter Cook X-Mailer: Apple Mail (2.734) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.02 required=5 tests=[AWL=0.020] X-Spam-Level: X-Archive-Number: 200510/41 X-Sequence-Number: 13972 Peter, 1) You need to specify the jar in the classpath, not just the directory. ie CLASSPATH=3D...;C:\Program Files\PostgreSQL\8.0\jdbc=20 \postgresql-8.0-311.jdbc3.jar 2) locate the postgresql.conf file and edit this to enable a =20 connection to be made, I believe you need to change listen_address to =20= '*' Dave On 8-Oct-05, at 3:34 AM, Peter Cook wrote: > It appears my first appeal for help wasn=92t clear enough. > > I want to connect my Java Application running on Windows 2000 to my =20= > postgresql database. > > =46rom what I understand and have read there are AT LEAST 2 things I =20= > need to do. > > (1) Have the application load the relevant JDBC driver and > > (2) Make a connection. > > With respect to (1), despite numerous attempts I have been unable =20 > to resolve the ClassNotFound exception. > > I have set the CLASSPATH environment variable as follows: > %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:=20 > \PROGRA~1\ULTRAE~1;C:\Program Files\Java\jdk1.5.0_04\bin;C:\Program =20= > Files\PostgreSQL\8.0\jdbc > > I have written some test code in Java to load the Driver, as follows: > public void displayClasspath() > { > String driverPath =3D "C:\\Program Files\\PostgreSQL\\8.0\=20 > \jdbc"; > String classpath =3D System.getProperty("java.class.path"); > _displayTextArea.append("Classpath =3D " + classpath + "\n"); > > classpath =3D classpath + ";" + driverPath + "\=20 > \postgresql-8.0-311.jdbc3.jar"; > System.setProperty("java.class.path", classpath); > _displayTextArea.append("Classpath =3D " + classpath + "\n"); > > System.setProperty("jdbc.drivers", driverPath); > String drivers =3D System.getProperty("jdbc.drivers"); > _displayTextArea.append("Drivers =3D " + drivers + "\n"); > > // 1. Load the jdbc.odbc database driver class > try > { > File driverDir =3D new File(driverPath); > if ( driverDir.isDirectory() ) > _displayTextArea.append("DriverDir is a directory \n"); > else > _displayTextArea.append("DriverDir is NOT a =20 > directory \n"); > > File dFile =3D new File(driverPath + "\\org\\postgresql\=20 > \Driver.class"); > if ( dFile.isFile() ) > _displayTextArea.append("Driver is a file \n"); > else > _displayTextArea.append("Driver is NOT a file \n"); > > String driver =3D "org.postgresql.Driver"; > driverPath =3D driverPath + "\\" + driver; > > Class.forName(driver); > } > catch (ClassNotFoundException cnfe) > { > System.out.println("ClassNotFoundException."); > } > } > > The output from this code is as follows: > Classpath =3D C:\Eclipse\Workspace\Test > Classpath =3D C:\Eclipse\Workspace\Test;C:\Program Files\PostgreSQL=20 > \8.0\jdbc\postgresql-8.0-311.jdbc3.jar > Drivers =3D C:\Program Files\PostgreSQL\8.0\jdbc > DriverDir is a directory > Driver is a file > > So: > - for some unknown reason my Eclipse editor has reset my CLASSPATH > - but despite this I am able to programmatically adjust the =20 > CLASSPATH property to suit > - Java recognized the directory where I have installed the JAR file =20= > as a valid directory and is able to locate the relevant driver file > > WHY WON=92T IT LOAD the DRIVER????? > > > With respect to (2) creating a connection. > =46rom what I have read I need to set the PostMaster to run with a =93-=20= > I=94 flag to enable TCP/IP communication. > However the Postmaster is started somewhere in the boot sequence, =20 > and I don=92t know how to adjust it=92s startup. > > HOW DO I DO THIS? > > > IS THERE SOMETHING ELSE I NEED TO DO??? > > I think I can work out the connection parameters and make the =20 > connection IF I CAN RESOLVE THESE QUESTIONS. > > Yours Sincerely > > Peter Cook > > _________________________________________________________________ > REALESTATE: biggest buy/rent/share listings http://=20 > ninemsn.realestate.com.au > > > ---------------------------(end of =20 > broadcast)--------------------------- > TIP 6: explain analyze is your friend > >