tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trond Hersløv <trond.hers...@gotogate.no>
Subject MySQL-connection pool
Date Mon, 14 Jun 2004 09:40:35 GMT
Hi !
I have installed MySQL and is able to access it in a servlet like this:
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/demo?user=tomcat&passwor
d=.tomcat.");
 
This creates a new connection to the DB every time, and I therefore want to
use a connection pool.
I tried to set up a connection pool in the tomcat-admin interface, but it
seems like I can't get it right. I'm also not quit sure how to
get a connection from the pool even if it is set up right.
I assume something like this would be correct: 
Connection conn = DriverManager.getConnection("mysql"), where mysql is the
jndi name of my pool.
 
The Tomcat documentation referrs to a non existing link (
http://jakarta.apache.org/commons/dbcp/api/index.html
<http://jakarta.apache.org/commons/dbcp/api/index.html> ).
 
Do I have to install any extra classes to make the connection pool work
correctly? Here is my current system config
Linux 2.4.20
Apache webserver: 2.0.49
jk2: 2.0.4
Tomcat: 5.0.24
MySql: 4.0.20
MySQL-connector: 3.0.12
J2SDK 1.4.2_04
 
Who can give me an example of how to set up and get a connection from a pool
with connections to a MySQL database?
 
Thanks, Trond
 
 


**********************************************************************
This email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message