O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Statement versus PreparedStatement versus CallableStatement

Choose between the Statement, PreparedStatement, and CallableStatement interfaces; it depends on how you plan to use the interface. The Statement interface is optimized for a single execution of an SQL statement, while the PreparedStatement object is optimized for SQL statements that will be executed multiple times, and CallableStatement is generally preferred for executing stored procedures:

  • Statement: The PreparedStatement is used to execute normal SQL queries. It is preferred when a particular SQL query is to be executed only once. The performance of this interface is very low.
  • PreparedStatement: The PreparedStatement interface is used to execute parametrized or dynamic ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required