Hi all, I am trying to establish connection from tContextLoad to tMysqlConnection. Before to accomplish the process I have prepared an excel file that contain context variable for the database connection (e.g : host, port, username, database, table, password). These context will be loaded from tFileInputExcel using tContextLoad. As the context successfully loaded, I try to connect tContextLoad to tMysqlConnection. This is to ensure that I can retrive the data based on the context variable that are stated in excel file without inserting any variables in the tMysqlConnection components. How do I get an automatic default database connection from the context I've loaded without putting anything in tMysqlInput component settings back? Is this possible? Is there any alternative way to accomplish above processes? Your help is very much appreciated. Thank you.
Hi The job design is not wrong, it should be: tContextLoad | onsubjobok | tMysqlConnection | onsubjobok | tMysqlInput--main--tLogRow | onsubjobok | tMysqlCommit tMysqlConnection: use context variable to set the db setting, create a db connection. tMysqlInput: check the option 'use an existing connection', it will use the db connection created by tMysqlConnection.\ tMysqlCommit: commit the change and close the db connection. Have a look at the user component manual and learn tContextLoad component, there is an example about this component .
Dear Shong.
I am a little bit confuse on how to use the context variable to set the db setting in order to create a db connection. Can you show me the processes..
Thank you..
Dear Shong.
Thank you for replying my question. Is it possible that I set the context variable in the excel file as the picture above instead of I set the context variable in the field of db components?. If yes can you show me the steps that should be taken?
Thank You Shong.
Hi No, the db fieldds must be filled in static value or context variable. The value of context variable can be stored in excel file. Set the db fields with context variables, as my job showed, use tContextLoad to load dynamically the value from excel file at runtime.
Hi Shong,
Do you know what is the meaning for these statement :
Exception in component tMysqlInput_1
java.sql.SQLException: Cannot convert value '1' from column 1 to TIMESTAMP.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1339)
at com.mysql.jdbc.ByteArrayRow.getTimestampFast(ByteArrayRow.java:129)
at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:6754)
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6073)
at talend.tcontextload_0_1.tContextLoad.tMysqlInput_1Process(tContextLoad.java:1523)
at talend.tcontextload_0_1.tContextLoad.tMysqlConnection_1Process(tContextLoad.java:1170)
at talend.tcontextload_0_1.tContextLoad.tFileInputExcel_1Process(tContextLoad.java:1037)
at talend.tcontextload_0_1.tContextLoad.runJobInTOS(tContextLoad.java:1998)
at talend.tcontextload_0_1.tContextLoad.main(tContextLoad.java:1837)
disconnected
Caused by: java.sql.SQLException: Bad format for Timestamp '1' in column 1.
at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1313)
Thank You..
Hi As the error showed, bad format for timestamp "1". You define the data type of column1 as Date, but the value of this column is 1, so please check you really need Date type for this column or Integer/int type?