472,782 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

JNDI DataSource with PostgreSQL and Tomcat

Hello group,

I have some questions concerning configuring and using a JNDI DataSource
with PostgreSQL and Apache Tomcat. Currently, I belive I have
successfully configured a "basic" DataSource. Currently, my configuration
which resides in a context.xml file is as follows:

<Context className="org.apache.catalina.core.StandardContex t"

charsetMapperClass="org.apache.catalina.util.Chars etMapper"

wrapperClass="org.apache.catalina.core.StandardWra pper">

<Resource name="jdbc/test" scope="Shareable"
<ResourceParams name="jdbc/test">
<value>org.apache.commons.dbcp.BasicDataSourceFact ory</value>
<value>SELECT * FROM test</value>

Using the above configuration, my JSP pages can connect to PostgreSQL and
perform all required database operations.

But all is not right! I have the following issues:

1.) Connections are NEVER closed
Say I hit my JSP page which perform a query and display the results.
Using netstat I can see that one connection to PostgreSQL has been
established. But then, if I uninstall and reinstall my web app and hit my
JSP page again, then the output of "netstat -p -t" shows that a second
connection to PostgreSQL is established.
The first connection never goes away! If I continue to
uninstall/reinstall/hit JSP page, the connections continue to acrue and
never go away. The number of connections can even exceed the value of
"maxActive" defined in my context.xml file. What am I doing wrong?

2.) Idle connections aren't closed
As mentioned above, the connections which are opened by my web app are
kept around forever and never closed. In my context.xml file above, I've
defined the "removeAbandoned" parameter to true and have set the
"removeAbandonedTimeout" parameter to 20 seconds. But the connections are
never closed. Every time I run "netstat -p -t", there they are. :(

3.) Is my configuration correct for performing Pooling?
I "can" get "a" database connection using this configuration. But is this
adequate to perform connection pooling? How can I tell if/when connection
pooling is actually being performed correctly?

Any help would be greatly appreciated.

Jul 19 '05 #1
0 5356

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action...
by: Jon Dellaria | last post by:
I have been using MySql as the database using JSP's and JavaBeans but recently I have wanted to start using the database connection pooling mechanism built into TomCat. I think I am having a...
by: Kent | last post by:
I'm running on Win2000 and JRE 1.4.1.... I've got a small client trying to do get an InitialContext() and talk to the local JBoss server running on same machine (different VM of course). When...
by: slurper | last post by:
i have problems understanding jndi. i'm this far: i deployed the sun application server and i'm working through the examples (Duke bookstore, ...). Sometimes i see code which does a lookup to a...
by: John Chambers | last post by:
Hi all, I'm relatively new to JNDI concepts and need some help. I am writing a web app that accepts a variable specifying a jndi pooled connection datasource as a url variable. This is a...
by: phil campaigne | last post by:
On Mon, 1 Mar 2004, phil campaigne wrote: >> Nigel J. Andrews wrote: >> > > >>> >On Mon, 1 Mar 2004, Phil Campaigne wrote: >>> > >>> >
by: dmjpro | last post by:
My context.xml... <Context path="/JNDITest"> <Resource name="jdbc/dataSource" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"...
by: dmjpro | last post by:
I thought that when the connection gets closed then all resources get closed . I also included the ResultSet and Statement ;) . But if the Statement closed then only ResultSet closed. But now i got...
by: kokababu | last post by:
Hi I am developing a WebService using Java (JAX-RPC). According to the requirement, I have to create a Thread to insert data into Database. So I am opening a database connection in the...
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
How does React native implement an English player?
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.