• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Questions Regarding Connection Pooling

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i have some confusion regarding how connection pooling is implemented..i have been doing some digging in to this lately but the more i read the more confused i get. i have some doubts here, will any of the posters here kindly clear them
a. Do i have to connect to my database via the DataSource method to take advantage of the connection pooling provided by my app server?..i have read conflicting information about this suggesting that Connection Pooling will not be provided to my app if i use DriverManager.getConnection()
b. if i chose to use the DataSource method do i have to implement the ConnectionPoolDataSource interface to provide the connection pooling for my app?
c. what is the best way to implement my own custom Connection pool?
Thanx
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A. is correct. If you use DriverManager.getConnection(), you are indeed bypassing the Connection Pool entirely.
B. usually, a third party connection pool will either give you the interface or they will give you the class file containing the DataSource object. In the latter case one has to Import the files, then create a new instance of it
"=new Source(); "
C. SEARCH AND yOU WILL GET ANSWER FOR THIS
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My answers
a.If you need to use Connetion Pool of the Application server you have to use DataSource.
b. I dint get the question but i will show a sample of how to use DataSource
InitialContext initialContext = new InitialContext();
DataSource dataSource = (DataSource)initialContext.lookup("java:comp/env/XXXX");
Connection connection = dataSource.getConnection();
c: Best way to implement Connection Pool . You could search on that. But i suggest you not to go for, if you use an application server that supports connection pooling. I beleive its an overhead. Its better we use what the application server provides
Thanks
renju
[ June 16, 2003: Message edited by: Renju Philip ]
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Shadab,
Are you going to reveal to us what the correct answers are? Or will that remain one of life's mysteries?
I'd like to throw in my two cents' worth (if you don't mind).
  • Well, that would depend on the implementation (or lack of) provided by your application server. What server would that be, by the way?
  • Not necessarily. Most probably not -- judging from the behaviour of the more popular application servers.
  • That would depend on what your requirements are. Sorry, but I didn't see any mention of your requirements, and I'm afraid I'm not a mind-reader.


  • Hope this has helped you.
    Good Luck,
    Avi.
    [ June 17, 2003: Message edited by: Avi Abrami ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic