IBMStreams/streamsx.jdbc

SQL JDBC Errors

estherhi opened this issue · 3 comments

I am trying to access the sql warnings on inserting records to dash db using the JDBC tookit.
We are using the following call to access the logs-
https://streams-console-c6d1.stage1.ng.bluemix.net/service/domain/instances/50c8e33c-b763-435a-92e6-9278149b123a/jobs/321/pes/805/applicationTraces/f0a91642-cb81-4513-85a4-6573975a9ca9?sortBy=-timeStr

However- I am not seeing any logs in application traces.
When i download the job logs (see attached) I see the following in the log-
13 Aug 2017 07:21:04.779 [11194] TRACE sslWriter M[SSLJsonWriter.cpp:serializeLogMsg:331] - Exit with msg: {"loglevel": "WARN","message": "CDIST2821W A SQL exception occurred. The exception is {0} .","request": "log","aspects": ["domain=standard1","instance=50c8e33c-

On Streams local-
09 Aug 2017 05:25:37.194 [10673] WARN #splapplog,J[0],P[0],n1502022268511repty6c5alilh.InsertRecord M[JavaOp.cpp:log:83] - CDIST2861W A SQL exception occurred. The exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][1091][10404][4.18.56] Invalid data conversion: Parameter instance 2017-08-08 09:48:21 is invalid for the requested conversion. ERRORCODE=-4461, SQLSTATE=42815

Seems like there is some localization issue where we don't see the full sql error as we should.

To summarise -

  1. Not seeing the sql exception/warning logs in application traces.

  2. The sql exception not being retrieved properly.

JDBCRun has two output ports.

Ports (0)
The JDBCRun operator has one required output port. The output port submits a tuple for each row in the result set

Ports (1)
The JDBCRun operator has one optional output port. This port submits tuples when an error occurs while the operator is running the SQL statement.

You have to use the second output port to get details about the SQL errors.
Here is an example:
https://github.com/IBMStreams/streamsx.jdbc/blob/master/samples/JDBCSample/com.ibm.streamsx.jdbc.sample.jdbcrun/JDBCRunErrorPort.spl

Thanks @anouri
However- we would like the error port output schema to contain the message as well to eliminate the need of creating another translation layer...
Who should be handling this.

corrected in JDCB toolkit version 1.2.2