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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to pass a database connection to a routine?

Hi,
I would like to make a java routine that takes a database connection as a parameter.
How can I do that?
Sebastien
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hi Sebastien
Use a txxxxConnection such as tMysqlConenction to create a DB connection in the job, and the pass this connection as a paramater to the routine like this:
YourRoutineName.methodName((java.sql.Connection) globalMap
.get("conn_tMysqlConnection_1"))

The routine is defined as below, for example:
  public static void methodName(java.sql.Connection parameterName) {
java.sql.Connection conn=parameterName;
...
}

Shong
Anonymous
Not applicable
Author

Hello,
I would like to create a routine which would call a database stored function. Then I would use the routine in a tMap.
I have written the routine but the performance is very poor as a jdbc database connection is created for every call to the routine. I am aware about connection pooling in J2EE  but do not know how to achieve that in Talend
What would be the best strategy to speed up the stored procedure call ?
Thanks for your ideas.
Lalaina
Anonymous
Not applicable
Author

Hi Irako,
it is not necessary to create a Connection for every record. This is a problem of your job design and not an issue of the solution shong provided. You could post your job design as screenshot, so we could make some suggestions. 
Anonymous
Not applicable
Author

Hi Lalaina,
Would you mind attaching your job design screenshots into forum?
Feel free to let us know if there is any problem to upload screenshot.
Best regards
Sabrina