If I use only one Statementat a time, is it worth it to cache along with mine Connection. I already cache the connection, so I could cache the statement with virtually no cost.
Statement
Connection
Essentially, I suppose I'm asking if there are any costs / overheads for creating an instruction. I fully understand the benefits of creating prepared statements. I am talking specifically about Connection.createStatement()here.
Connection.createStatement()
Some research on the open source jdbc driver ( jtds ) offers the following overhead for each application created. I am trying to calculate the cost of creating a new Statementone every time I want to query a database, and not contain one cached and reuse it:
TdsCore
ResultSet
ArrayList
So, it seems that the highest share of the cost Statementis related to what is left of any requested request.
; , JDBC, SQL ..
, Statement ( PreparedStatement) . , . , .
, ( ) . , , - , , , , . , , , . , .