[Pljava-dev] cannot set the classpath to a specific jar to get anexternal connection

From: Jon(dot)Roberts at asurion(dot)com (Roberts, Jon)
To:
Subject: [Pljava-dev] cannot set the classpath to a specific jar to get anexternal connection
Date: 2010-06-03 12:56:54
Message-ID: 8661B041D452404E8088FBD47D2443BE019EC515@NDCEXCUS703.int.asurion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

How are you connecting? Is it something like this:

Class.forName("org.postgresql.Driver");

String connectionUrl = "jdbc:postgresql://" + server +
":" + port + "/" + database;

conn = DriverManager.getConnection(connectionUrl,
userName, password);

Jon

-----Original Message-----
From: Luca Ferrari [mailto:fluca1978 at infinito.it]
Sent: Thursday, June 03, 2010 7:50 AM
To: Roberts, Jon
Cc: pljava-dev at pgfoundry.org
Subject: Re: [Pljava-dev] cannot set the classpath to a specific jar to
get anexternal connection

On Thursday 03 June 2010 02:15:30 pm Roberts, Jon's cat walking on the
keyboard wrote:
> I think you need to first install the jar and then set the class path.
>
> For example:
> select * from
> sqlj.install_jar('file:///java/jars/postgresql-8.4-701.jdbc4.jar',
> 'example_jar', true);
> select sqlj.set_classpath('public', 'example_jar');
>

Yes, I've installed the jar before ( I did not mention) and then I was
able to
set the classpath using the jar alias. However, keeping the jar
separated or
merging them into a single jar does not solve the problem and the error
still
is:

ERROR: java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost/myDb

and in the logs I've got the stacktrace:

java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost/myDB
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at itpug.pljava.RowGenerator.getResultSet(RowGenerator.java:40)
at
org.postgresql.pljava.internal.ResultSetPicker.<init>(ResultSetPicker.ja
va:25)

Summarizing this is what I've done:
1) sqlj.replace_jar to my new jar containing the Java client
2) sqlj.install_jar for the postgresql driver jar
3) set the classpath so that now I've got:
select sqlj.get_classpath('public');
get_classpath
---------------
driver:myJar
(1 row)

with driver the jar for the jdbc driver, and myjar the jar of my client.

Any suggestion?

Luca

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Luca Ferrari 2010-06-03 13:39:14 [Pljava-dev] cannot set the classpath to a specific jar to get anexternal connection
Previous Message Luca Ferrari 2010-06-03 12:50:09 [Pljava-dev] cannot set the classpath to a specific jar to get anexternal connection