How to use bind variables in Java Connector in render_complex_sql? Currently the SQL uses hard coded values in WHERE clause. To improve the performance, it is advised to use bind variables. I was able to use bind variables for INSERT and UPDATE statements in “beforeInsert” and “beforeUpdate” triggers. But I am not able to use similar technique for SELECT statement.
could you describe more in details what do you mean under ‘bind variables’?
To improve database performance Oracle recommends to use bind variables. In Java application this can be achieved by using PreparedStatement and ‘?’ place holders for parameters.
When I looked at JavaConnector source code I noticed that SQL strings are being created with parameter values hardcoded in them.
Hard coded values:
SELECT FIRST_NAME, LAST_NAME FROM USERS WHERE USER_NAME = ‘Jack’;
Using bind variables:
SELECT FIRST_NAME, LAST_NAME FROM USERS WHERE USER_NAME = ?
Create a PreparedStatement and use setString() to set USER_NAME parameter value.
I would like to use DHTMLX in my application, but being bit hesitant because of this issue. For applications with a low traffic, this may not pose any issue. But for applications with a high volume of traffic hardcoding is not suitable.
Please let me know if there are any plans to address this issue.
we don’t have plans to introduce such ability.