Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Gopi Chand Maddula
Ranch Hand
Posts: 40
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sandeep Sanaboyina
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gopi, Are you using an Oracle database???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic