-
Notifications
You must be signed in to change notification settings - Fork 4
Debugging
To determine if the JDBC driver is in use for a connection, turn on diagnostic trace events for ODBCConnectionTask SendMessage ODBCConnectionTask ReceiveMessage then when a new connection is made the MarkLogic Server log for the ODBC port will contain the following indicating that the JDBC driver is in use (and not the ODBC driver):
Info: [Event:id=ODBCConnectionTask ReceiveMessage] => Q SET application_name = 'MarkLogic JDBC Driver'
or 'PostgreSQL JDBC Driver'
For logging and debugging loggerLevel=TRACE or loggerLevel=DEBUG can be configured to see driver-level messages on the client.
For debugging SSL, add DEBUG -Djavax.net.debug=SSL to your JAVA command line.
On the client, using a connection string with loggerLevel TRACE jdbc:marklogic://localhost:8077/?loggerLevel=TRACE
FINEST: FE=> StartupPacket(user=admin, database=, client_encoding=UTF8, DateStyle=ISO, TimeZone=America/New_York, extra_float_digits=2)
Jan 17, 2018 9:32:18 AM org.postgresql.core.v3.ConnectionFactoryImpl doAuthentication
FINEST: <=BE AuthenticationReqMD5(salt=XXXXXXXX)
Jan 17, 2018 9:32:18 AM org.postgresql.core.v3.ConnectionFactoryImpl doAuthentication
FINEST: FE=> Password(md5digest=md5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
org.postgresql.util.PSQLException: Protocol error. Session setup failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:622)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:222)
To help debug problems with JDBC connection to the ML ODBC server, I have found the diagnostic trace events to be very helpful.
ODBCConnectionTask SendMessage
ODBCConnectionTask ReceiveMessage
The PostgreSQL network message protocol will get logged with messages like "R", "S" and "Q" (receive, send and query). For example, On the server with diagnostic trace events turned on:
[Event:id=ODBCConnectionTask SendMessage] 41 [authentication] <= R auth=5(MD5) md5salt=public
[Event:id=ODBCConnectionTask ReceiveMessage] => p
[Event:id=ODBCConnectionTask SendMessage] 71 [error response] <= E SERROR C08000 MXDMP-INTERNAL: Internal error: Password incorrect
ML is a read-only SQL interface (with some support for temporary views).
Watch out for any SQL that starts with BEGIN
The BEGIN;
will produce an error from ML: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected "<id>", expecting "<end of file>"
With diagnostic trace events turned on examine the SQL in the ML server log.
ODBCConnectionTask SendMessage
ODBCConnectionTask ReceiveMessage
Queries that start with BEGIN are trying to do transactions which are not supported by ML. It may be as simple as turning on autocommit
. It may be incompatible if the tool expects transaction support or writes to the database.
If you receive the error message: ERROR: XDMP-INTERNAL: Internal error: 'D': no such portal ""
Be sure to check the connection string for typos: preferQueryMode=simple
If you receive the stack trace message: org.postgresql.util.PSQLException: Protocol error. Session setup failed.
And the MarkLogic error log contains:
Info: [Event:id=ODBCConnectionTask SendMessage] 71 [error response] <= E SERROR C08000 MXDMP-INTERNAL: Internal error: Password incorrect
Then be sure the password is correctly encoded in your JAVA for Digest authentication