matlab error when connecting to postgresql database

Jepessen

I'm trying to connec to a PostgreSQL database with following command:

connection = database( ...
        options.getDatabaseName(), ...
        options.getUsername(), ...
        options.getPassword(), ...
        "org.postgresql.Driver", ...
        "jdbc:postgresql://" + options.getHostname() + ":" + options.getPort() + "/" + options.getDatabaseName() ...
        );

It returns me following error:

Error using database (line 59)
Unmatched parameter name 'org.postgresql.Driver' must be a string scalar or character vector that can represent a field name.

I've seen other questions about that, like this one but the error message is different.

What I'm doing wrong?

Jepessen

I've found the solution by myself, and it's tricky (maybe related to a bug in my opinion).

In order to test the database connection I've created first a connection with the Database explorer. It worked, and I saved this connection using the same name of the database.

When I use the database command, by inspecting it source code I've seen that the first thing that it does it to check if there's an existing data source with that name and, if not, it search for the database. The problem was that since my connection had the same database name, database supposed that I wanted to use the data source command version instead of the database. It tried to use this command:

conn = database(datasource,username,password)

instead of this one:

conn = database(databasename,username,password,driver,url)

since wtrade is both name of the database and of the data source. In that case the fourth argument, driver, must be a parameter name, like "Vendor" of "PortNumber", as per Matlab documentation, so since the driver string does not match a parameter name, I had the error.

I've removed the datasource with the same name of the database and everything started to work.

I've notified this to MathWorks, since in my opinion there should be no problem if a database has the same name of a datasource, since the signature are different, so database command should handle also this case.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Error when connecting to database

PHP error when connecting to MySQL database

Syntax error near: When connecting to mysql database

Error when connecting mysql database with node js

Authentication error when connecting to specific mongodb database

BLR error when connecting to Firebird database

MongoDB Mongoose error when connecting to the database

PostgreSQL - Error when restore database

Connecting to a PostgreSQL database through pq returns a "bad connection" error

password crypt authentication not supported error when connecting postgreSQL and automation anywhere

error connecting to database with mysqldriver

Error Connecting to database with PHP

ER_ACCESS_DENIED_ERROR when connecting to Mysql database

Cannot read property 'run' of null error when connecting to a database

'Could not SQLConnect' error when connecting dockerised model and dockerised database

error when connecting to a mysql database with a socket using socket.io

Kerberos error when connecting to Oracle database in .NET Core

An error when connecting to mLab database with nodejs and deprecation warnings

Failed to configure a DataSource: Intellij Error when connecting Database to Spring Application

PDO Error "Adaptive Server is unavailable" when connecting to MS SQL Database

Error when connecting one app to a different app's database

Postgres ENOTFOUND error when connecting docker services to a docker database container

GAE restricted class error when connecting to SQLite database

Error 2002 or 2013 when connecting to my MariaDB database on Cloud SQL

Error in creating SEQUENCEs when restoring the PostgreSQL database

No attribute "execute" error on connecting to PostgreSQL

Spark JDBC error connecting to PostgreSQL

pyodbc error when connecting to SQL database "Cannot open database "database3" requested by the login."

Invoke-Sqlcmd fail when connecting to Postgresql Database and doing SQL command

TOP Ranking

HotTag

Archive