1

I followed the steps listed in the previous answer to this question here

How can I access a postgresql database from matlab with without matlabs database toolbox?

However, on the step

driver = org.postgresql.Driver;

I'm getting the following error.

Undefined variable "org" or function "org.postgresql.Driver"

I've added it to the dynamic path, and running "javaclasspath" shows the following at the bottom

    DYNAMIC JAVA PATH

M:\postgresql-9.3-1100.jdbc41.jar

any ideas on what is wrong?

Community
  • 1
  • 1
jhlu87
  • 3,999
  • 8
  • 38
  • 48
  • try using `javaObject('org.postgresql.Driver')`. Does this raise a clear exception? – Daniel Nov 18 '13 at 21:24
  • Here's what that outputs Error using javaObject No class org.postgresql.Driver can be located on the Java class path – jhlu87 Nov 18 '13 at 21:40

1 Answers1

3

You probably got the wrong bytecode-versin of postgresql. The jdbc41 is for java 1.7 and 1.8 only, which is not included at least up to Matlab 13a. Only 13b has Java 1.7 with jdbc41 integrated.

Type ver to check your current JRE integrated into Matlab, then download the correct bytecode-version of postgresql, which is probably jdbc4.

Daniel
  • 36,610
  • 3
  • 36
  • 69
  • 1
    you're right that solved it. I downloaded java 1.7 separately, but didn't realize matlab came with its own which was 1.6. Thanks! – jhlu87 Nov 18 '13 at 22:18