[ 
https://issues.apache.org/jira/browse/GERONIMO-6714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16814990#comment-16814990
 ] 

David Jencks commented on GERONIMO-6714:
----------------------------------------

Thanks for your interest. Since the geronimo server is no longer being 
developed, there is no opportunity to apply your proposed patch.

I agree that using a prepared statement would be better than hard-coded 
queries. However, your patch as-is won't work since the connection for the 
prepared statement is not obtained until after entering the loop, and is closed 
on each iteration.  It's somewhat difficult for code accessing a db, but for 
such reasons it's a great idea to write tests for code changes, or at least 
provide evidence that you've tested them.

In this case, I would also look at the source of the list of timestamps to 
delete and see if they are contiguous and if so use a single query deleting the 
range of timestamps rather than a loop.

> Use PreparedStatement
> ---------------------
>
>                 Key: GERONIMO-6714
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-6714
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: databases
>            Reporter: bd2019us
>            Priority: Major
>         Attachments: patch.txt
>
>
> {color:#24292e}Hello,{color}
> {color:#24292e}Is it a good way to use "PreparedStatement" instead of 
> "createStatement" to improve performance?  "PreparedStatement" is helpful if 
> we are executing a particular parameterized SQL query multiple times ( such 
> as "Delete..." in this case) since "PreparedStatement" can be precompiled and 
> the query is created only once. {color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to