Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everybody.
I'm a newbie in talend world, looking for advice.
I'm trying to develop the following job:
- read database connection parameters from a cfg file and put them in context variables (LibContextReader, inspired by talendbyexample.com, page talend-reusable-context-load-job )
- define and test a connection to DB that uses the context variables
- do some input-output with the connected DB
- store in a DB table the stats from tStatCatcher
If I put the caught stats in a file or in a table through a non-parametric connection, it works, also if I leave the tStatCatcher as Starting Job, with no problem.
But if I try to put the stats in a table using a parametric connection or the existing connection (both of them use context variables), I get the "NULL parameter" kind of error from tMysqlOutput component.
I tried to start tStartCatcher after the reading of parameters and after the first test of the connection (rif Main_Job screenshot), but it doesn't help.
It seems to me that the iMysqlOutput component tries to resolve its connection parameters before they are available.
(The screenshot isn't the real job, I have left only the relevant components)
Trying to use the Existing connection (rif. screenshot) I get in the console:
"Exception in component tMysqlOutput_5
java.lang.NullPointerException
at dwh_king.king_dwh_build_0_1.king_dwh_build.tStatCatcher_1Process(king_dwh_build.java:6519)
at dwh_king.king_dwh_build_0_1.king_dwh_build.runJobInTOS(king_dwh_build.java:17766)
at dwh_king.king_dwh_build_0_1.king_dwh_build.main(king_dwh_build.java:17477)"
and the component reaches the table (can create it) but doesn't write the stats into it, and the main job is labeled as failed.
Trying a direct parametric connection (rif. screenshot) I get in the console:
"Exception in component tMysqlOutput_3
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception:
'java.lang.NumberFormatException: For input string: "null"'.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
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.NonRegisteringDriver.connect(NonRegisteringDriver.java:353)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at dwh_king.king_dwh_build_0_1.king_dwh_build.tStatCatcher_1Process(king_dwh_build.java:6542)
at dwh_king.king_dwh_build_0_1.king_dwh_build.runJobInTOS(king_dwh_build.java:17828)
at dwh_king.king_dwh_build_0_1.king_dwh_build.main(king_dwh_build.java:17539)
Caused by: java.lang.NumberFormatException: For input string: "null"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.mysql.jdbc.NonRegisteringDriver.port(NonRegisteringDriver.java:913)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
... 5 more"
the main job is labeled as failed,
but the component reaches the table and writes the stats into it (exactly like the non-parametric, non-error component).
This second way seems to get the work done, but I would prefer understand and get rid of those error messages.
Thank for your help.