• 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: 2599
12
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
Saloon Keeper
Posts: 4020
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic