This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes Connections issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Connections issue" Watch "Connections issue" New topic
Author

Connections issue

Miltos Tereres
Ranch Hand

Joined: Sep 04, 2009
Posts: 32
Hello...
I have some classes within my model...which do some tasks..
For connections i use apache connection pooling stuff....
My question is..




getblabla() and getall() is ok to get a new connection from the pool ? Is there a better way to just use one connection as long as the servlet is being executed?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2896
    
    1

As you're using DBCP, then getting and releasing connection object in each method is good and widely used technique.
Actually, what you need is good tutorial on DAO and DTO, for this, follow:
http://balusc.blogspot.com/2008/07/dao-tutorial-data-layer.html


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Connections issue
 
Similar Threads
Connection Pooling
Connection Pooling
Running out of database connections using JSP
what is connection pooling?
Control the Connections in the Connection Pool?