1

Can anyone offer a clue on how to diagnose the error listed below? Note, I CAN connect to this DB2 instance via DB2 connect, but not thru jdbc.

   org.apache.openjpa.persistence.PersistenceException: Unable to open a test 

connection to the given database. JDBC url = jdbc:db2://dxxx_xxx.xxx.com:5000/XXXXX:deferPrepares=false, username = NNNNN. Terminating connection pool. Original Exception: ------
    com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10165][10051][3.63.75] Invalid database URL syntax: jdbc:db2:/dxxx_xxx.xxx.com:5000/XXXXX:deferPrepares=false. ERRORCODE=-4461, SQLSTATE=42815
        at com.ibm.db2.jcc.am.fd.a(fd.java:679)
        at com.ibm.db2.jcc.am.fd.a(fd.java:60)
        at com.ibm.db2.jcc.am.fd.a(fd.java:85)
        at com.ibm.db2.jcc.DB2Driver.tokenizeURLProperties(DB2Driver.java:911)
        at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:408)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:215)
        at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256)
        at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:305)
        at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150)
1
  • I was missing a ; at the end of the connection string. Commented Jun 24, 2016 at 14:00

2 Answers 2

3

The error message is pretty self-explanatory:

Invalid database URL syntax

You must not have any spaces in the URL, and key-value pairs are separated with semicolons, not commas. Note that you must put a semicolon after the last value too.

jdbc:db2://dxxx_xxx.xxx.com:5000/XXXXX:deferPrepares=false;username=NNNNN;

Details can be found in the manual.

Sign up to request clarification or add additional context in comments.

Comments

-1

Take a look at this information taken from the DB2 documentation (added link of the reference below).

Message text: text-from-getMessage

Explanation: The specified value is invalid or out of range.

User response: Call SQLException.getMessage to retrieve specific information about the problem.

SQLSTATE: 42815

Reference: https://www.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_rjvjcsqc.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.