File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "doubt" Watch "doubt" New topic
Author

doubt

Maya Pillai
Ranch Hand

Joined: Jul 17, 2008
Posts: 60
Can I reuse a Statement/Prepared Statement or must I create a new one for each query?

Please help
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Maya Pillai wrote:Can I reuse a Statement/Prepared Statement or must I create a new one for each query?

Please help


Yes you can OR you can try with a small program to ensure it.. I used it with one precautions while using PreparedStatement, which is clear all the parameters before assigning it different query.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38429
    
  23
Please don't use thread titles like "doubt;" people like to know what the thread is about.
 
wood burning stoves
 
subject: doubt