One Star

using datasource in child jobs

Hi
I have a simple Rest service deployed on karaf and using datasource (the datasource is configured and works correctly).
The job design looks like bellow :
Scenario1
tRestRequest----->tFlowToIterate---->tjobRun (the child job use tmysqlinput that use datasource alias) ==> in this case datasource is not used.
Scenario2
tRestRequest----->tFlowToIterate--->tMysqlInput ====> in this case datasource is used
So my question is, is it possible to use datasource in child job when deployed as Dataservice?
Thanks for your help.
2 REPLIES
Community Manager

Re: using datasource in child jobs

Hi
I want to say I don't understand your problem well, what do you mean the datasource is used or is not used? Scenario2 is the child job called with tRunJob in Scenario1?
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: using datasource in child jobs

Hi Shong
Thank you for your reply.
PFA screenshot my two tests, which I called scenario1 and scenario2.
As you can see in scenario1 I use a tMysqlconnection with datasource (all other parameters host, port etc.. are empty) and tmysqlinoput_1 uses tMysqlconnection. The service is deployed on runtime and works perfectly.
In Scenario2, the db connection is in child job. In this case I obtain the bellow error in esb logs. What I understand, is that the child job is trying to open connection to database in regular manner (by using the connection parameters) and ignoring the datasource parameter.
Hope it's more clear :-)

INFO | jvm 1 | 2014/03/28 07:16:41 | Exception in component tMysqlConnection_1
INFO | jvm 1 | 2014/03/28 07:16:41 | java.sql.SQLException: Must specify port after ':' in connection string
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.NonRegisteringDriver.parseHostPortPair(NonRegisteringDriver.java:219)
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.NonRegisteringDriver.parseURL(NonRegisteringDriver.java:707)
INFO | jvm 1 | 2014/03/28 07:16:41 | at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
INFO | jvm 1 | 2014/03/28 07:16:41 | at java.sql.DriverManager.getConnection(DriverManager.java:579)
INFO | jvm 1 | 2014/03/28 07:16:41 | at java.sql.DriverManager.getConnection(DriverManager.java:221)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testds_0_1.testDS.tMysqlConnection_1Process(testDS.java:1289)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testds_0_1.testDS.tPrejob_1Process(testDS.java:1201)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testds_0_1.testDS.runJobInTOS(testDS.java:1551)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testds_0_1.testDS.runJob(testDS.java:1414)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testdschapeau_0_1.testDSChapeau.tRESTRequest_1_LoopProcess(testDSChapeau.java:1250)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testdschapeau_0_1.testDSChapeau$RestServiceProviderImpl4TalendJob.processRequest(testDSChapeau.java:432)
INFO | jvm 1 | 2014/03/28 07:16:41 | at poc_uump.testdschapeau_0_1.testDSChapeau$RestServiceProviderImpl4TalendJob.testDS(testDSChapeau.java:536)
INFO | jvm 1 | 2014/03/28 07:16:41 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2014/03/28 07:16:41 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
INFO | jvm 1 | 2014/03/28 07:16:41 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2014/03/28 07:16:41 | at java.lang.reflect.Method.invoke(Method.java:601)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:115)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:354)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:318)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1040)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:976)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.Server.handle(Server.java:363)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
INFO | jvm 1 | 2014/03/28 07:16:41 | at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
INFO | jvm 1 | 2014/03/28 07:16:41 | at java.lang.Thread.run(Thread.java:722)
INFO | jvm 1 | 2014/03/28 07:16:41 | Exception in component tMysqlInput_1
INFO | jvm 1 | 2014/03/28 07:16:41 | java.lang.NullPointerException