[resolved] Database connection disconnected on subjob
Hi, We have a problem when we reuse a database connection (we have tried with Oracle and MySQL) on a subjob, when the flow returns to parent job, the connection is closed, and we need to keep it open and do some stuff with it. Here are the screenshots... Parent job:
I don't know why it appears so low-def, the flow goes like this: connection -> subJob (after these lines) -> if error -> rollback; if ok -> mysqlinput -> log -> commit.
Sub job:
When the flow reaches the input in main job, crashes with this: Starting job DBLinkMySQL at 11:47 17/02/2015. connecting to socket on port 3379 connected .--+-----. |tLogRow_1| |=-+----=| |id|login| |=-+----=| |1 |admin| '--+-----' Exception in component tMysqlInput_1 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.Util.getInstance(Util.java:384) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1321) at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1313) disconnected at com.mysql.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:2696) at com.mysql.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:2678) at proyecto_1.dblinkmysql_0_1.DBLinkMySQL.tMysqlInput_1Process(DBLinkMySQL.java:1088) at proyecto_1.dblinkmysql_0_1.DBLinkMySQL.tRunJob_1Process(DBLinkMySQL.java:669) at proyecto_1.dblinkmysql_0_1.DBLinkMySQL.tMysqlConnection_1Process(DBLinkMySQL.java:479) at proyecto_1.dblinkmysql_0_1.DBLinkMySQL.runJobInTOS(DBLinkMySQL.java:1603) at proyecto_1.dblinkmysql_0_1.DBLinkMySQL.main(DBLinkMySQL.java:1460) Job DBLinkMySQL ended at 11:47 17/02/2015. As you can see, connection is used in sub job and the query runs perfect. But trying the same query after that job has finished, at the main job, outputs than exception. Thoughts? Anyway to solve this? Thanks a lot!!!
Hi, Can you please post the screen shot here? Also try disabling the "Close connection" option in the tmysqlcommit component. Thanks, Karthikeyan J. www.mytalend.in
The commit is in the main job, it's ok that it closes the connection. The problem is that the subjob only gets some data, and after it finishes the connection is closed. I mean, we need the connection open after the subjob finishes and before the commit is done (there are some operations between them). Thanks!!