• 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

Connection Pool/App Server

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am developing an internal company system for entering and tracking orders. I am using JSP and Servlets using Tomcat. There will be about 30 users using this software constantly - do I need a connection pool and if so do you know where I can get this for free.
Is is realistic to write this kind of software and run on Tomcat or should I try to get my company to invest in an Application Server?
Any advice would be appreciated
Thank you
Pamela
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that Tomcat has basic connection pooling functionality built in, but if it doesn't DBConnectionBroker is free.
 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which is better? Tomcat's connectionpool or the free ones on net (book)?
Anyway, I can't find anywhere which teaches us how to implement connectionpool in tomcat.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection pool included with newer versions of Tomcat would be jakarta's "commons" project's "DBCP"

http://jakarta.apache.org/commons/dbcp.html

I've used this and it worked fine. Mind you the app was never under a lot of stress. But I'd give this one a try before anything else. And my own opinion would be to use what others have worked on (why re-invent the wheel?)
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is an example of using it in Tomcat here.
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems quite complex than just adopting a connectionPool.java on the net huh?
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you could also try connection pooling in apache jakarta turbine.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Matthew Phillips:
There is an example of using it in Tomcat here.


Hi Mr.Phillips
Here is my Working Environment:
Windows 2000 Professional
J2SDK 1.4
Tomcat 4.0.6
mysql server version: 4.1.0-alpha ( on linux server)
JDBCdriver mysql-connector-java-3.0.8-stable-bin.jar
I am trying to implement connection pooling as described in
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example
After modifying server.xml, web.xml and creating connection class and jsp, I start Tomcat through the short-cut which executes startup.bat file. This pops-up tomcat console with all error messages and when I execute shutdown.bat file this window doesn't even close.
Could you successfully implement connection pooling as described in above link, if so I would like to know what I am missing?
Thank you in advance.
Rao Manekar
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whichever way you go, realize the following.
When desiging a web app as you have described, it is ALWAYS better to use a pool. I suggest that you ALWAYS get that pool from JNDI as a javax.sql.DataSource object. Many, many other APIs, tools and products are designed to work with either a java.sql.Connection or a javax.sql.DataSource. You use web.xml to define the name of the DataSource you want (via a <resource-ref> tag) and your code is good to go.
All that gives you is a .war file that fits the standard. Your code will use an existing DataSource, but not configure one. The configuration of the DataSource is done one of two ways. In a server specific way, you define a DataSource. With tomcat this is done in the server.xml file (last I checked anyway). With many other J2EE servers, there is a GUI to do this (there may be one with Tomcat now). Tomcat does use the Jakarta Commons classes to do this. The other way is to have your app create the connection. This is not recommneded, but once the DataSource is up and running, it works the same way.
 
Narsimha Manekar
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Kenneth Robinson
Thanks for your reply. I still did not get answer to my problem.
I gave up working using JNDI.
Anyway, I was able to implement connection pooling using coreservlets utility very easily. It is very simple and straigth forward.
http://archive.coreservlets.com/Chapter18.html
Rao
reply
    Bookmark Topic Watch Topic
  • New Topic