Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
IBuruleanu1666252610
Contributor
Contributor

Support QueryTimeout in Oracle database components

Hello Everyone,

We have an issue with Talend Oracle database components. For data manipulation components (such as tDbRow, tDbInput) we would like to be able to use the underlying's Java sql Statement instance options such as setQueryTimeout.

At the moment, we have to construct our own components using the tDbConnection and write the logic from scratch.

A simple example in a tJavaRow:

output_row.errorCode = null;

output_row.queryErrorMessage = null;

java.sql.Connection conn_tJavaRow = (java.sql.Connection)globalMap.get("conn_tDBConnection_1");

java.sql.Statement stmt_tJavaRow = conn_tJavaRow.createStatement();

stmt_tJavaRow.setQueryTimeout(context.query_timeout != null ? ((Long)context.query_timeout).intValue() : 0);

String query = "...";

try {

stmt_tJavaRow.execute(query);

log.info("tJavaRow - Execute the query: '" + query + "' has finished.");

} catch (java.lang.Exception e) {

log.error("tJavaRow - " + e.getMessage());

output_row.errorCode = ((java.sql.SQLException) e).getSQLState();

output_row.queryErrorMessage = e.getMessage();

} finally {

stmt_tJavaRow.close();

}

Is there any possibility to support this inside the components themselves?

Thanks

Labels (3)
3 Replies
Anonymous
Not applicable

Hello,

If querytimeout is implemented via the connection string in oracle, you could try to add the parameter queryTimeout=X to the addtional JDBC parameter field in the advanced settings panel of tOracleInput component. eg:

"noDatetimeStringSync=true;queryTimeout=10".

Best regards

Sabrina

 

 

 

 

IBuruleanu1666252610
Contributor
Contributor
Author

Hi xdshi,

 

Unfortunately, I cannot find such option for tDbRow (with Oracle connection):

 

0695b00000YCZsXAAX.png 

This is only visible in tDbConnection by the option additional JDBC Params, but we tested this out already and it does not work.

 

0695b00000YCZuOAAX.png 

Thanks

Anonymous
Not applicable

Hello,

Because the query timeout is related to the Statement object itself.

According to the documentation it offers this functionality:

https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#setQueryTimeout(int)

It would be a feature request as setting this timeout requires access to the Statement object.

Best regards

Sabrina