Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Ashok200792
Contributor
Contributor

How to insert or update data into table by using tmysqlrow_1?

how to Insert or update the data into table by using tmysqlrow_1 

 

QUERY:

 

"update CHECK_DATA SET FLAG='K' where FLAG='"+row1.invoiceno+"'"

 

show error,

Starting job FileProcess_Copy at 15:12 21/11/2017.

[statistics] connecting to socket on port 3914
[statistics] connected
Exception in component tMysqlRow_1 (FileProcess_Copy)
java.lang.NullPointerException
at local_project.fileprocess_copy_0_1.FileProcess_Copy.tFileInputDelimited_2Process(FileProcess_Copy.java:5779)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.tFileList_1Process(FileProcess_Copy.java:1206)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.tMysqlConnection_1Process(FileProcess_Copy.java:850)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.runJobInTOS(FileProcess_Copy.java:12808)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.main(FileProcess_Copy.java:12651)
[statistics] disconnected
Job FileProcess_Copy ended at 15:12 21/11/2017. [exit code=1]

 

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Ok in that case, you may want to try using a tmysqloutput component instead of tmysqlrow.

https://help.talend.com/reader/D_AHwO__5PjfWaaJKtDD1A/7IH8hy9EzjA85l5C4boMdA 

 

I read your use case again. Doesn't look like it will work using the tMysqloutput command.

As an alternative, We could output the distinct FLAG values to a flat file first.

And then you can do something like this,

0683p000009Ls0z.png

The tMysqlRow should have your update query for each distinct flag in the input file.

View solution in original post

12 Replies
Anonymous
Not applicable

Can you check if the mysql row component is configured correctly?

Try to execute a simple select statement to see if that works first before going to the update statement.

Ashok200792
Contributor
Contributor
Author

Yes before we checked tmysqlrow ,we wrote the simple query select query its working fine ,

 

For Example:

 

I get the CSV data file to insert into the DataBase , its working fine . At the same time need to update the another table in Database to dynamically based on the records , we using tMap function to insert the data ,same as we try here get the some value & Update the another table.

 

0683p000009Ls1N.jpgInside the tMap,0683p000009LrtQ.jpg

 

 

 

 

Anonymous
Not applicable

Ok so in your query you have used "row1.invoiceno" but the job shows that your input link is "update". So I am guessing it should be "update.invoiceno". Maybe you can try that out and see what happens.

 

edit : just checked the tmap again, it should actually be update.FLAG.

Ashok200792
Contributor
Contributor
Author

we used the "update.invoice" but its shows error0683p000009LrSd.jpg

 

So how we can solve this issue , any other methods have to update the database . 

Anonymous
Not applicable

Can you use update.FLAG?

Ashok200792
Contributor
Contributor
Author

Yeah we can use "update.FLAG" , same error will come

 

[statistics] connecting to socket on port 3459
[statistics] connected
Exception in component tMysqlRow_1 (FileProcess_Copy)
java.lang.NullPointerException
at local_project.fileprocess_copy_0_1.FileProcess_Copy.tFileInputDelimited_2Process(FileProcess_Copy.java:5753)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.tFileList_1Process(FileProcess_Copy.java:1180)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.tMysqlConnection_1Process(FileProcess_Copy.java:828)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.runJobInTOS(FileProcess_Copy.java:12657)
at local_project.fileprocess_copy_0_1.FileProcess_Copy.main(FileProcess_Copy.java:12500)
[statistics] disconnected
Job FileProcess_Copy ended at 17:10 21/11/2017. [exit code=1]

Anonymous
Not applicable

Ok in that case, you may want to try using a tmysqloutput component instead of tmysqlrow.

https://help.talend.com/reader/D_AHwO__5PjfWaaJKtDD1A/7IH8hy9EzjA85l5C4boMdA 

 

I read your use case again. Doesn't look like it will work using the tMysqloutput command.

As an alternative, We could output the distinct FLAG values to a flat file first.

And then you can do something like this,

0683p000009Ls0z.png

The tMysqlRow should have your update query for each distinct flag in the input file.

Ashok200792
Contributor
Contributor
Author

Thanks for Support,

 

Now the update query is working fine , in tMysqlrow_1 0683p000009LraJ.png

 ADDED:

When we connected the tMysqlconnection , that update query is working or Else its show that previous error .

Anonymous
Not applicable

Great. Using the tMySQLConnection is a better way to connect to the database.