tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris McCluskey <>
Subject Jdbc-odbc bridge: app not closing MSSQL database connections
Date Tue, 16 Oct 2001 20:42:51 GMT
Hello, I am having a problem with my database connections not closing
with MSSQL and jakarta tomcat on a WIN-NT 4 box.  Here's a run down of
the damage:


<jsp:useBean id="db" class="com.netsolutions.dataBase">

ResultSet rs = db.query("SELECT blah FROM foo");
while( {
  blah:  <%= rs.getString(1) %>


-------------- (snippet):

import java.sql.*;
import java.lang.Class;

public class dataBase {

  private Connection con;

  public void connect() {

    try {
    } catch (Exception e) {

    try {
      con = DriverManager.getConnection ("jdbc:odbc:mydsn","username",
    } catch (SQLException se) {
      System.out.println("SQL Exception: " + se.getMessage());


  public void close() {
    try {
      // rs.close();
    } catch (SQLException se) {
      System.out.println("SQL Exception: " + se.getMessage());


Keep in mind that I only posted the connect() and close() methods in
the dataBase class..

the problem that i'm having is everytime i would use page.jsp, the
database connection would open, i would get my ResultSet passed, but
afterwards, even when i run the close() method on the connection
varible the database connection is still open.. I think this is half
the server environment, and half my app..

any suggestions?

Thanks in advance!


Chris McCluskey, Web Applications Engineer 
Net Solutions, LLC 
840 Lawrence Street 
Eugene, OR 97401 
Voice +1 541 345-7087 
Fax +1 541 485-5519 
The contents of this transmission may be confidential in 
nature and should be directed only to the person to whom it 
is addressed. Do not read, copy, or disseminate this 
material unless you are the intended recipient. If this 
transmission reached you in error, please forward the e-mail 
to the sender to advise, then destroy the transmission you 
received. Thank you. 

View raw message