Coder Social home page Coder Social logo

Comments (6)

chanskw avatar chanskw commented on June 7, 2024

I looked at the related code:

I think the errorCode and sqlState should be passed into the submitErrorTuple function. Otherwise, we could get into the situation when we are submitting the error tuple, the errorCode and sqlState are overwritten in the process method, when there are multiple streams feeding into the input port?

catch (SQLException e){
errorCode = e.getErrorCode();
sqlState = e.getSQLState();
TRACE.log(TraceLevel.DEBUG, "SQL Exception Error Code: " + errorCode);
TRACE.log(TraceLevel.DEBUG, "SQL EXCEPTION SQL State: " + sqlState);
if (hasErrorPort){
// submit error message
submitErrorTuple(errorOutputPort, tuple);
}

from streamsx.jdbc.

chanskw avatar chanskw commented on June 7, 2024

Here's something you can use to simulate a connection lost.

In JDBCRun.allPortsReady()

I created a thread. The thread sleeps for x number of seconds. When the timer pops, we disconnect from the db.

In JDBCConnectionHelper, I added a method to force the connection to be closed. This method simply call connection.close()... I purposefully did not change any state or do any checks to simulate something unexpected. Call this method on the thread from allPortsReady.

from streamsx.jdbc.

yiminy avatar yiminy commented on June 7, 2024

Just delivered a fix on this issue. Please let me know if it does not work for you.
Meanwhile, as existing design on sqlStatus and error tuple processing are not very clear, I am going to re-design this feature.

from streamsx.jdbc.

chanskw avatar chanskw commented on June 7, 2024

Thanks! let me try that out.

from streamsx.jdbc.

yiminy avatar yiminy commented on June 7, 2024

The operator will check if the JDBC connection is valid before processing the tuple. If it is not valid, the operator will reset the connection.
So there are two scenarios:

  1. The connection lost before tuple processing, you will not get the error tuple from error port.
  2. The connection lost during tuple processing, you will get the error tuple from error port.

from streamsx.jdbc.

anouri avatar anouri commented on June 7, 2024

corrected in JDBC version 1.4.0
https://github.com/IBMStreams/streamsx.jdbc/releases/tag/v1.4.0

from streamsx.jdbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.