One Star

Reg: Calling two context files in one job

Hi,
I want to call two context files in one job. One of my context file consist of Database credentials and the other context file holds the name of a source file from which I should read the data for my job.
I am not able to call both the context file one job.
But as per my requirement values like database credentials and source file name is configurable. My source file name changes for each and every load.
How can I achieve this in Talend. Is there any viable solution for this issue? Please suggest me some method where I can do this.
I have also used tFileList. My tFileList points out to a folder where my context files are defined. Context values are defined as following
db_connections.txt
host;10.xxx.xxx.xx;
port;3306;
username;abc;
password;def;
database;XYZ;
source_filename.txt
FILENAME;/usr/local/filename-2010-dt.log; -----> which is a delimited file
I have to pass these two files in my next job
I have used
tFileList -Iterate-> tfileInput -main-> tContextLoad -On Component ok->tFileInputdelimited-main->tMysqlOutput
I am able to fetch the value correctly till tContextLoad.
I have also define my context for the values in my context tab as specified in context file. I can't use both these files together. It's throwing an error

Please see the error message and also screenshots
connecting to socket on port 4200
connected
tContextLoad_1 set key "FILENAME" with value "/usr/local/filename-2010-dt.log"
199 milliseconds
disconnected
Exception in component tMysqlOutput_1
java.sql.SQLException: Must specify port after ':' in connection string
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.mysql.jdbc.NonRegisteringDriver.parseHostPortPair(NonRegisteringDriver.java:164)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1905)
at com.mysql.jdbc.Connection.<init>(Connection.java:716)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:353)
at com.mysql.jdbc.Connection.getInstance(Connection.java:295)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at amr4_etl.job_tfilelist_0_1.job_tFileList.tFileInputDelimited_2Process(job_tFileList.java:3821)
at amr4_etl.job_tfilelist_0_1.job_tFileList.tFileList_1Process(job_tFileList.java:777)
at amr4_etl.job_tfilelist_0_1.job_tFileList.runJobInTOS(job_tFileList.java:6824)
at amr4_etl.job_tfilelist_0_1.job_tFileList.main(job_tFileList.java:6705)
Job job_tFileList ended at 12:20 20/05/2010.
Please let me know whether my approach as method is correct.

Thanks
Naju
3 REPLIES
Employee

Re: Reg: Calling two context files in one job

Hi Naju
Can you try by changing the onComponentOk link with a OnSubjobOK one ?
One Star

Re: Reg: Calling two context files in one job

Hi Camsellem,
Thanks for the response. But there is no link as OnSubJob ok when you right click on tContextLoad component.
Thanks
Naju
Employee

Re: Reg: Calling two context files in one job

Yes this is normal the link should be after tFileList (start point of your subjob).