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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to run a .sql file in Talend

Hi,
I have a .sql file which contains my ETL scripts. How can i trigger it directly from Talend.
I can run the statements directly from tMSSqlRow but i want to keep the scripts in a file and want Talend to pick the .sql file and execute it on SqlServer DB.
Labels (2)
23 Replies
Anonymous
Not applicable
Author

This is probably another bug in Talend. Under some circumstances Talend Studio does not create any code for a component and therefore all return values are null and the component does nothing.
To be sure this is the point in your case please do following:
1. Open the job
2. select the tSQLScriptParser component
3. switch to the Code tab (next to the Designer tab at the buttom of your job view)
4. check if you can see any code related to this component like:
				/**
* start
*/
int NB_ITERATE_tWarn_1 = 0; // for statistics
ok_Hash.put("tSQLScriptParser_1", false);
start_Hash
.put("tSQLScriptParser_1", System.currentTimeMillis());
currentComponent = "tSQLScriptParser_1";
int tos_count_tSQLScriptParser_1 = 0;
de.cimt.talendcomp.dbtools.SQLParser tSQLScriptParser_1 = new de.cimt.talendcomp.dbtools.SQLParser();
try {

Especially you should find the creation of the instance tSQLScriptParser_1.
If you do not find this code, please delete the file:
<studio>/configuration/ComponentCache.javacache
and restart your studio.
Anonymous
Not applicable
Author

Dear jlolling,
Thanks for spending time on my issue.
My job is actually missing the following part you mentionned.
int tos_count_tSQLScriptParser_1 = 0;
de.cimt.talendcomp.dbtools.SQLParser tSQLScriptParser_1 = new de.cimt.talendcomp.dbtools.SQLParser();
try {
I presume that missing piece is the SQLParser constructor.
So I performed what you said:
1 - Delete ComponentsCache.javacache file
2- Restart TOS
No luck, it is stil not working.
I have created a new job
tSQLScriptParser --> Iterate --> tJava
tJava component contains this piece of code
System.out.println((String)globalMap.get("tSQLScriptParser_1_STATEMENT_SQL")) ;
running the job;
Here's the output:
Starting job Test at 14:41 30/08/2013.

connecting to socket on port 4009
connected
null
disconnected
Job Test ended at 14:41 30/08/2013.

I could always use a stored procedure or calling sqlcmd but I would like to avoid those options.
Any other idea to solve this issue ?
Thanks,
Lalaina
Anonymous
Not applicable
Author

Yes thats what I worried about. In which way did you installed this component?
In case you have tried using Talend Exchange view in the Studio please try to install it manually and follow this advise:
https://help.talend.com/search/all?query=Installing+a+custom+component&content-lang=en
In case you have installed it this way, please try to use the Exchange view.
It is a bug in studio but unfortunately I could not figure out the reason and reproduce it for sure. The only thing I know is changing the way of installation mostly solves the problem.
Anonymous
Not applicable
Author

hello ,
how to get number of rows to be processes .(i.e the   schema is a row description. It defines the number of fields to be processed and passed on to the next component.). i want this schema as a log in a text file .