MATLAB to postgreSQL

12 views (last 30 days)
Dmitry
Dmitry on 10 Jan 2012
I try to connect matlab and postgresql,
conn = database('database', 'postgres', '12345', 'org.postgresql.Driver', 'jdbc:postgresql://localhost:5432/');
but
Error using database>errorhandling (line
209)
[Microsoft][ODBC Driver Manager] Data
source name not found and no default driver
specified Please verify that login
information and database url are valid.
Error in database (line 184)
errorhandling(connection.Message);
Error in convertDBtoMat (line 26)
conn = database('database', 'postgres', '12345');
What i need to do
thank you

Answers (1)

the cyclist
the cyclist on 10 Jan 2012
Two thoughts:
  1. Have you added the driver to your path? You need a statement like javaaddpath('/path_to_directory/postgresql-8.3-604.jdbc3.jar')
  2. Is your database source name really called "database"?
  3 Comments
the cyclist
the cyclist on 10 Jan 2012
Hm. I don't think I have any other specific hypotheses of what it could be. Some general things you could try, though:
Use the debugger to halt the execution inside database.m, stepping through to see where exactly the database object "connection" might seem to be going wrong. It will make a call to the java method "makeDatabaseConnection" (probably on line 130), so that's a good place to check if things are in order.
Are you able to connect to the database from your machine using another program? For example, can you use the same setup to access your database using pgAdmin?
You might want to contact Mathworks support. Database Toolbox questions often don't get a lot of traffic here, so I suspect there are not a lot of people knowledgeable about it.
Dmitry
Dmitry on 10 Jan 2012
Thank you. I will try to do something.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!