Connect to PostGres db in 2011b

조회 수: 2 (최근 30일)
Eoin
Eoin 2011년 9월 30일
Hi, I've upgraded to 2011b but still have 2010b running on my windows machine (both are 64-bit). Code that connects fine with my postgres dbin 2010b is having problems in 2011b. Here's the code:
conurl = ['jdbc:postgresql://localhost:5432/' dbname];
% Connect to the database.
con =database(dbname,username,password,'org.postgresql.Driver', conurl);
e = exec(con, ['select * from "tablename" ']);
cell_data = fetch(e);
This works a treat in 2010b but comes back with 'Undefined function 'fetch' for input arguments of type 'struct'. The value of e is 'Message: 'Invalid connection.''.
Does anyone know what the problem is? Why is this fine in 2010b and not 2011b? Please don't tell me i can't now connect to postgres - i had to move to postgres from MS Access because Matlab 64-bit can't connect to a MS Access database, so don't tell me i now have to move to another database platform.
Any help would be greatly appreciated.
Eoin

채택된 답변

Oleg Komarov
Oleg Komarov 2011년 9월 30일
Verify that the path to the java driver is in javaclasspath.txt with:
javaclasspath
  댓글 수: 1
Eoin
Eoin 2011년 9월 30일
Fantastic!
Thanks Oleg. Absolutely right!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Dmitry
Dmitry 2012년 1월 10일
"Verify that the path to the java driver is in javaclasspath.txt with:" what does it mean ?
Can u explain ? thank you
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 1월 10일
At the MATLAB prompt, give the command
javaclasspath
Look through the list of directory names shown. Is the path to your database drive shown in the list? If not then you will need to edit javaclasspath.txt to put it there (and will probably need to restart MATLAB.)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by