Re: JDBC connection issue

Lists: pgsql-jdbc
From: "Young Nam" <Ynam(at)sharedmarketing(dot)com>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC connection issue
Date: 2004-07-13 17:52:28
Message-ID: 581C48EBC132FF459E62A6809D0D72AE22C74A@mail.sharedmarketing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Ok. I've changed the pg_hba.conf from 'local' to 'host' but still the same exception.

java.lang.ClassNotFoundException: org.postgresql.Driver

echo $CLASSPATH returns the correct value
/usr/local/pgsql/share/java/postgresql.jar

Does it have anything to do with reinstalling postgresql? I've installed the postgresql before but I've deleted the directory into which it was installed /usr/local/pgsql and rebuilt it from the source with the --with-java option.

Thanks,

YJ

-----Original Message-----
From: Kris Jurka [mailto:books(at)ejurka(dot)com]
Sent: Tuesday, July 13, 2004 11:41 AM
To: Young Nam
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] JDBC connection issue

On Tue, 13 Jul 2004, Young Nam wrote:

> The default directory for the postgresql.jar is
> /usr/local/pgsql/share/java/postgresql.jar I've run >jar -tf
> /usr/local/pgsql/share/java/postgresql.jar and the class files seem to
> be in the right order.
>
> I've added the following line to the pg_hba.conf to test local
> connections via jdbc driver.
> local all all 127.0.0.1 trust

You need to use "host" not "local" here. Local is only for unix sockets
which cannot be used with Java.

> Added CLASSPATH to bashrc file
> export CLASSPATH=/usr/local/pgsql/share/java/postgresql.jar:${CLASSPATH}
>
> java.lang.ClassNotFoundException: org.postgresql.Driver
>

When you check the classpath with something like echo $CLASSPATH is it set
as you specified?

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org


From: Kris Jurka <books(at)ejurka(dot)com>
To: Young Nam <Ynam(at)sharedmarketing(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC connection issue
Date: 2004-07-13 17:57:55
Message-ID: Pine.BSO.4.56.0407131254260.27632@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Tue, 13 Jul 2004, Young Nam wrote:

> Ok. I've changed the pg_hba.conf from 'local' to 'host' but still the
> same exception.

Right, this is unrelated to the problem you mentioned, but this would be
the next problem you would run into after solving your original problem.

> echo $CLASSPATH returns the correct value
> /usr/local/pgsql/share/java/postgresql.jar
>

This cannot be the classpath that you are actually using. If so it
couldn't find your test program. Are you providing a -cp or -classpath
argument on the java command line when running the test program? If so
this is overriding the environment variable. You need to get both the jar
file and the test program into the same classpath. It doesn't matter if
it's the environment or command line one, but it needs to be the same.

Kris Jurka