• Post Reply Bookmark Topic Watch Topic
  • New Topic

Statement for more then one insert quries

 
ehsan ulhaq dar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my bean class i execute more then one insert quries. Whether i use only one statement object to execute these quries or i used separate statement object for separate qury? What is sun recommendation?
 
Jan Cumps
Bartender
Posts: 2620
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ehsan,

You can reuse the object.
Regards, Jan
 
Scott Selikoff
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Statements can be re-used although unless the queries are strongly related its often a better design to close and finish your first statement and open a new statement elsewhere. In other words, don't keep a single statement for the entire JDBC application, as your likely to have issues with opening/closing it if an exception occurs.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!