aspose file tools*
The moose likes JDBC and the fly likes Connection pooling with my own cofiguration file instead of Initial Context. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection pooling with my own cofiguration file instead of Initial Context." Watch "Connection pooling with my own cofiguration file instead of Initial Context." New topic
Author

Connection pooling with my own cofiguration file instead of Initial Context.

Gopi Chand Maddula
Ranch Hand

Joined: May 11, 2010
Posts: 40

Hi Java Ranch,

I am working on a web application an i want to implement the Connection Pooling. And i wat to store my database details in a seperate properties file instead of placing them in Context.xml.

I had done some modification to Connection Pool Class for getting details from configuration file.


my all queries are in a normal java class. I am trying to get connection in a init() method of a servlet so that i can get connection at any time.

My servlet's Init method has the following code



if i use another servlet then i can get the connection object. But through a normal java class i wat to get a connection object. but how can i get the connection object.
Please help me in this issue...

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You'll need to make it available to your class somehow. For normal ConnectionPools this would be done via the DataSource bound in JNDI. If you are not doing something simmilar your normal class will need to configure its own instance of your pool.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Sandeep Sanaboyina
Ranch Hand

Joined: Dec 14, 2009
Posts: 72
We faced a similar problem as we had to use ConnectionPooling for core java programs. We solved it by writing our own implementation of connection pooling.

The concept is to create a static Connection pool object for each database at startup. During the initialization itself the connections are established. Then the getConnection method can be accessed throughout the application.


They say you have to be the first, the best or different. I say, is it too much to ask for all three.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


We faced a similar problem as we had to use ConnectionPooling for core java programs. We solved it by writing our own implementation of connection pooling

I think that is what Gopi is trying to do.
Sandeep Sanaboyina
Ranch Hand

Joined: Dec 14, 2009
Posts: 72
Gopi, Are you using an Oracle database???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection pooling with my own cofiguration file instead of Initial Context.
 
Similar Threads
connection pool problem
problem in connectionpooling
problem in connectionpooling
Problems with connection pooling.
how many initial connections should be opend