Mule database connector url format for DB2 not cor

2019-08-29 02:34发布

问题:

I am trying Mule's Database Connector to connect to a DB2 database but I couldn't figure out the correct format for the database URL. I created a Generic Database Configuration global element with Database URL

jdbc:db2://db01.dev.myserver.org:50000/mydb;User=test;Password=secret

And Driver

com.ibm.db2.jcc.DB2Driver

When I click Test Connection, it says

Test connection failed: Cannot get connection for URL
jdbc:db2://db01.dev.myserver.org:50000/mydb;User=test;Password=secret :
[ibm][db2][jcc][t4][10205][11234] Null userid is not supported. 

How shall I put the username and password in the URL?

Thanks!

回答1:

JDBC properties, such as user and password need to be separated from the rest of the URL with a colon (":"), and each property, including the last one, should be terminated with a semicolon (";"). I suspect the property names may be also case-sensitive. So

jdbc:db2://db01.dev.myserver.org:50000/mydb:user=test;password=secret;

Reference: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_rjvdsprp.html?lang=en



标签: url jdbc db2 mule