From: | "Dave Cramer" <Dave(at)micro-automation(dot)net> |
---|---|
To: | "Corey Mosher" <corey(at)pgsql(dot)com>, <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Still having trouble getting JDBC working |
Date: | 2001-04-19 23:12:10 |
Message-ID: | 035e01c0c926$2987cdc0$230470d1@INSPIRON |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Corey,
This looks like it should work.
The only thing I can think of is that you need to export the classpath so
that it is visible outside of the .cshrc file?
what to you get when you execute
echo $CLASSPATH
The only other possibility is that you are using a real old version of the
driver. At one time the driver was in a package postgresql.Driver
try looking at the contents of the postgres char
jar -tvf postgresql.jar should list the contents.
Other than that your code looks like it should execute
Regards,
Dave
----- Original Message -----
From: "Corey Mosher" <corey(at)pgsql(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Sent: Thursday, April 19, 2001 2:56 PM
Subject: [JDBC] Still having trouble getting JDBC working
> Hi
> Can anyone help me with this problem? I have jdk1.2.2 installed on
> a freeBSD system. My class path in .cshrc is as follows:
>
> set CLASSPATH = (/usr/local/lib/postgresql.jar)
>
> I get this error:
>
> Exception caught.
> java.lang.ClassNotFoundException: org.postgresql.Driver
> Exception caught.
> java.sql.SQLException: No suitable driver
> Ok
>
> When running the following code (I replaced all the connection stuff with
x's for privacy reasons):
>
> import java.io.*;
> import java.sql.*;
> import java.util.*;
>
> public class test{
>
> public static void main(String args[]){
> Connection conn; // holds database connection
> Properties prop = new Properties();
> prop.put("jdbc.drivers", "org.postgresql.Driver");
> System.setProperties(prop);
> try {
> Class.forName("org.postgresql.Driver"); // load database
interface
> } catch(Exception exc){
> System.err.println("Exception caught.\n" + exc);
> }
> try {
> conn =
DriverManager.getConnection("jdbc:postgresql://xxxxxxxx:5432/xxxxx",
"xxxxx", "xxxxxx");
> } catch(Exception exc){
> System.err.println("Exception caught.\n" + exc);
> }
> System.out.println("Ok");
> //conn.close();
> }
}
>
> Does the postgresql.jar file need any special permissions? Right now I
have:
>
> -rw-r--r-- 1 root wheel 153145 Apr 16 08:53
/usr/local/lib/postgresql.jar
>
> Any ideas?
>
> Thanks.
>
> Corey Mosher
>
> -----------------------------
> Hub.Org Networking Services
> 251 Main St.
> Wolfville, NS
> Canada
> B0P 1X0
> Email: corey(at)hub(dot)org
> Phone: (902) 542-3657
> -----------------------------
> PostgreSQL, Inc.
> 251 Main St.
> Wolfville, NS
> Canada
> B0P 1X0
> Email: corey(at)pgsql(dot)com
> Phone: (902) 542-0713
> -----------------------------
> Fax: (902) 542-5386
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | jlemcke | 2001-04-20 00:36:24 | Re: Still having trouble getting JDBC working |
Previous Message | Hunter Hillegas | 2001-04-19 22:45:37 | A Bug Fix - Is this a real bug? Has this already been fixed? |