MATLAB to postgreSQL

6 次查看(过去 30 天)
Dmitry
Dmitry 2012-1-10
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

回答(1 个)

the cyclist
the cyclist 2012-1-10
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 个评论
the cyclist
the cyclist 2012-1-10
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 2012-1-10
Thank you. I will try to do something.

请先登录,再进行评论。

类别

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