Bind values are used in SQL / JDBC for various reasons. Among the most obvious ones are:
Protection against SQL injection. Instead of inlining values possibly originating from user input, you bind those values to your prepared statement and let the JDBC driver / database take care of handling security aspects.
Increased speed. Advanced databases such as Oracle can keep execution plans of similar queries in a dedicated cache to prevent hard-parsing your query again and again. In many cases, the actual value of a bind variable does not influence the execution plan, hence it can be reused. Preparing a statement will thus be faster
On a JDBC level, you can also reuse the SQL string and prepared statement object instead of constructing it again, as you can bind new values to the prepared statement. jOOQ currently does not cache prepared statements, internally.
The following sections explain how you can introduce bind values in jOOQ, and how you can control the way they are rendered and bound to SQL.
Tell us a little bit about yourself and join our newsletter
We will keep this information strictly confidential
Help us understand your needs by completing this survey
jOOQ has been the leading Java Open Source SQL building tool for the last three years. Feedback on social media such as Facebook, Twitter, reddit, Stack Overflow has been overwhelmingly positive.
You can influence jOOQ's future in the professional OSS world. By completing this survey, you help us take the right decisions to provide you with an even better Java / SQL integration in the future. All of the provided information will be kept strictly confidential.
You are using an old browser, which we no longer support. Please upgrade your browser to the latest version of any of