• 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

how to create a connection pool?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a jsp i want to connect to oracle data base using the connection pool how can i do that?
need a complte code
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"niroshan niroshan",
We're really glad that you are here with us in the JSP forum, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
JSP Forum Bartender
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No one here is going to give you "a complte code". You need to either: search using google to find a package that someone has already written, try to write your own (in which case people here will fall all over themselves to help you when you run into trouble), or use container-managed pooling if your servlet container supports it (as Tomcat does).
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DB connection pooling JSPs/servlets
Surfing the internet on the topic of database connection pooling left me a little bit confused, because there are two different approaches. There is a whole chapter in the O'reilly book "Java Server Pages" which clarifies this nicely (get it from safari.com)

Here's a sumary:
You can either use a JDBC 2 DataSource object, which means the webserver manages the connections, or you can have a java class which manages connections. JDBC 2 Datasource approach should be your first choice. It involves putting a <resource> tag somewhere in your web server configuration. This is web server specific, and is not supported by all web-servers. I am having to use the static class approach. I am using DbConnectionBroker from www.javaexchange.com There's a different one from here here: http://www.webdevelopersjournal.com/columns/connection_pool.html Either way you should construct the manager/broker class in your servlet/JSP init method.
For the connection itself, you should always get --> use --> release a connection for every request (i.e. in the 'doPost' method). Don't get a connection in the init method, and Dont keep a connection as a session variable, or in a bean. It might seem like a good idea, but it isn't.
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic