Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

approach other than connection pooling

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is best approach for writing database operation in web application if you are not going for connection pooling?

Thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The is not likely to be any difference in the code, but your code is probably going to use up more database resources, since a Connection will actually equal a connection to the database, rather than sharing connections in the way connection pooling does it.

I suppose if you didn't want to use connection pooling you could try to write your code to share connections. But why bother? There are plenty of connection pool implementations out there, why reinvent the wheel?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ankur rathi:
What is best approach for writing database operation in web application if you are not going for connection pooling?

I guess that would just mean that you have your own connection factory that always creates a new connection. Make sure to close the connection when you are done so you don't have a resource leak.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic