[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] jdbc and postgres



i had a headache using that one so i used the
org.sourceforge.jxdbcon.JXDBConDriver from sourceforge :)

if you look at the docs for it it has a very usefull example program that
gets you going in minutes.
If you want to use the existing postgres driver then i just checked and my
jars for that version and for the sourceforge driver are in :
/usr/lib/pgsql/jdbc6.5-1.1.jar
/usr/lib/pgsql/jxDBCon-net-jdbc3-0.9b.jar

ah, found it.
Add the path to the jar, whichever you choose to the CLASSPATH export.

type export to get a list of exports then type
export CLASSPATH=<whatever was there
before>:/usr/lib/pgsql/jxDBCon-net-jdbc3-0.9b.jar
and it'll find it.

Hope this helps
----- Original Message -----
From: "Gavin Hay" <gavin_hay@xxxxxxxxx>
To: <cobalt-developers@xxxxxxxxxxxxxxx>
Sent: Thursday, November 29, 2001 10:50 AM
Subject: [cobalt-developers] jdbc and postgres


> I've looked through the archives and I can't find the
> answer to my particular question.
>
> I've put the postgres jdbc jar file "jdbc6.5-1.2.jar"
> into /usr/java/jakarta-tomcat/lib directory and edited
> the /etc/profile.d/java.sh such that the classpath
> includes the jar. I've written a little java class to
> connect but I get an error saying it can't find the
> class. What do you think i've done wrong. Other posts
> indicate putting the jdbc file into the lib
> directory..done. Other posts indicated putting the
> classpath line in..done. I'm stumped.
>
> Thanks for your help
> -
> -
> TestPG.java:
> -------------
> import java.sql.*;
>
> class TestPG {
>         public static void main (String[] args) {
>         Connection conn = null;
>         Class.forName("org.postgresql.Driver");
>         conn =
> DriverManager.getConnection("jdbc:postgresql:XXX","XXX","XXX");
>         conn.close();
>         }
> }
>
> Error Msg:
> ----------
> TestPG.java:6: unreported exception
> java.lang.ClassNotFoundException; must be caught or
> declared to
>  be thrown
>         Class.forName("org.postgresql.Driver");
>              ^
> TestPG.java:7: unreported exception
> java.sql.SQLException; must be caught or declared to
> be thrown
>         conn =
> DriverManager.getConnection("jdbc:postgresql:STAR","ghay","november");
>                             ^
> TestPG.java:8: unreported exception
> java.sql.SQLException; must be caught or declared to
> be thrown
>         conn.close();
>             ^
> 3 errors
>
> _______________________________________________________
> Build your own website in minutes and for free at http://ca.geocities.com
>
> _______________________________________________
> cobalt-developers mailing list
> cobalt-developers@xxxxxxxxxxxxxxx
> http://list.cobalt.com/mailman/listinfo/cobalt-developers
>