• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gopi, Are you using an Oracle database???
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic