File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes JNDI problem for getting connection from a pool - Tomcat 4.1.18 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "JNDI problem for getting connection from a pool - Tomcat 4.1.18" Watch "JNDI problem for getting connection from a pool - Tomcat 4.1.18" New topic
Author

JNDI problem for getting connection from a pool - Tomcat 4.1.18

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi there !
I�m trying to use the Tomcat�s connection pool but something I don�t know is going wrong. The code snippet is as follows :
. . .
Object value = ctx.lookup("java:/comp/env/dsdb1");

Connection c = ((DataSource) value).getConnection();
. . .
I�ve already configured the DataSource for the context I�m using the pool with the parameters as follows :
Property Value
JNDI Name: dsdb1
Data Source URL: jdbc:mysql://localhost:3306/turma1
JDBC Driver Class: org.gjt.mm.mysql.Driver
User Name: root
Password:
Max. Active Connections: 5
Max. Idle Connections: 2
Max. Wait for Connection: 5000
Validation Query:
The USE NAMING parameter is set to true.
I�m using a .jsp to test the pool with the code above , but when I call the testpool.jsp page, the browser keeps on waiting for the server�s response... I�ve already tracked the code and it �stops� right on the getConnection method.
Any idea why it�s �freezing� ?
Thanks !
F�bio
herbert christy
Greenhorn

Joined: Mar 10, 2002
Posts: 6
Hi,
I encountered the same problem and I read somewhere. It works.
Make sure the common-dbcp & pool-1 jar files are located in
/common/lib folder. These jar files can be downloaded from tomcat website.
The next step is adding these parameters between your <ResourceParams>
in your server.xml

Somehow, after I added these parameters, it works fine.
Give it a try.
 
 
subject: JNDI problem for getting connection from a pool - Tomcat 4.1.18
 
Threads others viewed
How to make a data source connection without writing a User name & Password and the -ds.xml file
question about getConnection(usr,pwd)
Connecting jsp with derby
Problem in deploying multiple EARs in same JBOSS having same application and EJBs in all the EARs
Validating user/password for database connection
developer file tools