IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 1 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Need help setting up java and postgres -- updated
I've got Postgres installed and working. I've got Java installed and working. I got the postgres jdbc from the postgres site, put it where the docs said to, got the .jar files in the classpath and still no joy.

Details/versions:
psql 7.4.6
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
grabbed pg74.215.jdbc3.jar and put it in /usr/share/java
symlinked /usr/share/java/postgresl.jar to pg74.215.jdbc3.jar
have tried $CLASSPATH=/usr/share/java/postgresql.jar:. and $CLASSPATH=/usr/share/java/:.

Used the test file at [link|http://www.telenovela-world.com/~spade/linux/howto/Enterprise-Java-for-Linux-HOWTO-6.html|http://www.telenovel...inux-HOWTO-6.html] under Confirming Your Installation. (Corrected the missing curly brace at the end.) Try to compile and get this:
drook@droogy:~/java/code$ javac PostgreSQLTest.java\nPostgreSQLTest.java:7: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown\nClass.forName("postgresql.Driver").newInstance();\n^\nPostgreSQLTest.java:7: unreported exception java.lang.InstantiationException; must be caught or declared to be thrown\nClass.forName("postgresql.Driver").newInstance();\n^\n2 errors
Googled for an hour to find that the code linked above doesn't catch all the exceptions. Added:
        } catch (ClassNotFoundException cnfe) {\n            System.out.println("ClassNotFoundException");\n            System.out.println(cnfe.toString());\n
and a few other 'catch'es. Now get this:
drook@droogy:~/java/code$ java PostgreSQLTest\nClassNotFoundException\njava.lang.ClassNotFoundException: postgresql.Driver\n
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
Expand Edited by drewk Jan. 14, 2005, 11:31:22 PM EST
New Does this work?
The example [link|http://www.postgresql.org/files/documentation/books/aw_pgsql/node154.html|here] at Postgres is a little different. Does it work? If so, maybe it'll help you determine what's wrong.

Luck!

Cheers,
Scott.
New Score!
Turns out I needed /usr/share/java in the path before the local directory, and I needed 'org.postgresql.Driver' instead of 'postgresql.Driver'.

Thanks muchly.
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
     Need help setting up java and postgres -- updated - (drewk) - (2)
         Does this work? - (Another Scott) - (1)
             Score! - (drewk)

Only technical details are missing.
41 ms