Thread: Problem linking Postgresql JDBC driverb and Matlab (Linux)

Problem linking Postgresql JDBC driverb and Matlab (Linux)

From
Tuan Nguyen
Date:
Hello,

I know this subject has also to do with Matlab, but I do not get any
answer on the Matlab forum, so I allow myself to crosspost my question
here. The Matlab error messages give however a lot of indications that
may be relevant to readers of this newsgroup.

I am still having some problems trying to connect Postgresql via the
JDBC driver and Matlab. I believe that Matlab does not know where the
driver is.

I am just wondering if I am using the right driver for my version of
Java and I am wondering whether my export CLASSPATH has the good
syntax. Can somebody help me as it is driving me nuts (I've been
working on this for a quite a few days) ?

I am also wondering why it requires the SSL module (cf below). It
seems that this function is supported by Java 1.4 only, and my Matlab
runs on Java 1.3.1. Shall I change the Java version of Matlab (and in
that case, how can I do it ?).

Thanks.

Configuration :
Slackware 9.1 - Matlab 6.5 R13 - Java 1.4.2_03, but Matlab runs on
1.3.1 Blackdown

EDU>> version -java

ans =

Java 1.3.1 with Blackdown Java-Linux Team Java HotSpot(TM) Server VM
    (mixed mode)

I tried drivers pg74.215.jdbc2ee.jar and pg74.215.jdbc3.jar

I added in classpath.txt :
/usr/local/pgsql/share/java/pg74.215.jdbc2ee.jar (and then tried with
pg74.215.jdbc3.jar)

and from bash :
export CLASSPATH=/usr/local/pgsql/share/java/pg74.215.jdbc2ee.jar:.

(is this the right syntax ?)

and from Matlab :

EDU>> java.lang.Class.forName('org.postgresql.Driver');
??? Java exception occurred:
java.lang.ClassNotFoundException: org/postgresql/Driver
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120).

EDU>> conn = database('testdb','postgres','postgres','org.postgresql.Driver','jdbc:postgresql://masd/MOSE');
??? Java exception occurred:
java.lang.NoClassDefFoundError: javax/net/ssl/SSLSocket
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at com.mathworks.toolbox.database.databaseConnect.makeDatabaseConnection(databaseConnect.java:100).

Error in ==> /usr/local/matlab6p5/toolbox/database/database/@database/database.m
On line 114  ==> connectionVector = makeDatabaseConnection(conn);

EDU>> confds
??? Java exception occurred:
java.lang.NoClassDefFoundError: javax/net/ssl/SSLSocket
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at com.mathworks.toolbox.database.databaseConnect.makeDatabaseConnection(databaseConnect.java:100).

Error in ==> /usr/local/matlab6p5/toolbox/database/database/@database/database.m
On line 114  ==> connectionVector = makeDatabaseConnection(conn);

Error in ==> /usr/local/matlab6p5/toolbox/database/vqb/loginconnect.m
On line 26  ==>   c = database(datasource,u,p,srcs{i,2},srcs{i,3});

Error in ==> /usr/local/matlab6p5/toolbox/database/vqb/confds.m
On line 141  ==>       c = loginconnect(sourcestr);

??? Error while evaluating uicontrol Callback.

Thanks very much for your help.

Re: Problem linking Postgresql JDBC driverb and Matlab (Linux)

From
Yi LIN
Date:
Hi,

I also use postgresql jdbc in planetlab and I have no problem with the
driver. Your classpath setting looks correct. Why don't u try a small jdbc
program without Matlab? If it works then it means that Matlab requries u
to register the jdbc driver somewhere in Matlab's configuration.

Regards,

Yi

On Wed, 22 Sep 2004, Tuan Nguyen wrote:

> Hello,
>
> I know this subject has also to do with Matlab, but I do not get any
> answer on the Matlab forum, so I allow myself to crosspost my question
> here. The Matlab error messages give however a lot of indications that
> may be relevant to readers of this newsgroup.
>
> I am still having some problems trying to connect Postgresql via the
> JDBC driver and Matlab. I believe that Matlab does not know where the
> driver is.
>
> I am just wondering if I am using the right driver for my version of
> Java and I am wondering whether my export CLASSPATH has the good
> syntax. Can somebody help me as it is driving me nuts (I've been
> working on this for a quite a few days) ?
>
> I am also wondering why it requires the SSL module (cf below). It
> seems that this function is supported by Java 1.4 only, and my Matlab
> runs on Java 1.3.1. Shall I change the Java version of Matlab (and in
> that case, how can I do it ?).
>
> Thanks.
>
> Configuration :
> Slackware 9.1 - Matlab 6.5 R13 - Java 1.4.2_03, but Matlab runs on
> 1.3.1 Blackdown
>
> EDU>> version -java
>
> ans =
>
> Java 1.3.1 with Blackdown Java-Linux Team Java HotSpot(TM) Server VM
>     (mixed mode)
>
> I tried drivers pg74.215.jdbc2ee.jar and pg74.215.jdbc3.jar
>
> I added in classpath.txt :
> /usr/local/pgsql/share/java/pg74.215.jdbc2ee.jar (and then tried with
> pg74.215.jdbc3.jar)
>
> and from bash :
> export CLASSPATH=/usr/local/pgsql/share/java/pg74.215.jdbc2ee.jar:.
>
> (is this the right syntax ?)
>
> and from Matlab :
>
> EDU>> java.lang.Class.forName('org.postgresql.Driver');
> ??? Java exception occurred:
> java.lang.ClassNotFoundException: org/postgresql/Driver
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:120).
>
> EDU>> conn = database('testdb','postgres','postgres','org.postgresql.Driver','jdbc:postgresql://masd/MOSE');
> ??? Java exception occurred:
> java.lang.NoClassDefFoundError: javax/net/ssl/SSLSocket
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:120)
>     at com.mathworks.toolbox.database.databaseConnect.makeDatabaseConnection(databaseConnect.java:100).
>
> Error in ==> /usr/local/matlab6p5/toolbox/database/database/@database/database.m
> On line 114  ==> connectionVector = makeDatabaseConnection(conn);
>
> EDU>> confds
> ??? Java exception occurred:
> java.lang.NoClassDefFoundError: javax/net/ssl/SSLSocket
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:120)
>     at com.mathworks.toolbox.database.databaseConnect.makeDatabaseConnection(databaseConnect.java:100).
>
> Error in ==> /usr/local/matlab6p5/toolbox/database/database/@database/database.m
> On line 114  ==> connectionVector = makeDatabaseConnection(conn);
>
> Error in ==> /usr/local/matlab6p5/toolbox/database/vqb/loginconnect.m
> On line 26  ==>   c = database(datasource,u,p,srcs{i,2},srcs{i,3});
>
> Error in ==> /usr/local/matlab6p5/toolbox/database/vqb/confds.m
> On line 141  ==>       c = loginconnect(sourcestr);
>
> ??? Error while evaluating uicontrol Callback.
>
> Thanks very much for your help.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>
>


Re: Problem linking Postgresql JDBC driverb and Matlab (Linux)

From
Kris Jurka
Date:

On Wed, 22 Sep 2004, Tuan Nguyen wrote:

> I am also wondering why it requires the SSL module (cf below). It
> seems that this function is supported by Java 1.4 only, and my Matlab
> runs on Java 1.3.1. Shall I change the Java version of Matlab (and in
> that case, how can I do it ?).

SSL support is only available in the jdbc2ee and jdbc3 jar files.  If you
are running the 1.3 JDK without the additional enterprise edition jar
files you should be using the plain jdbc2 jar file.

Kris Jurka