Re: number of connections keeps increasing

2001-11-25 Thread yilmaz
Hi takashi,
My environment is :
Win2000, jdk1.3,  tomcat 4,
Well, i am sure i added a snippet which closes statemnt and the connection.
for example, below is the snippet from one of my pages content.jsp :

% if (stmt!=null) { // actually this is a curly left brace
  stmt.close(); }  // actually this is a curly right brace
  if (conn!=null){ // stmt is a Statement object
  conn.close();  //  conn is a Connection object
  } %

whenever i call this page , number of connections inreases by one
it seems that the connections can not be closed
Any idea or suggestions ?
thanks a lot in advance
best regards :)

- Original Message -
From: "TAKAHASHI, Tomohiro" [EMAIL PROTECTED]
To: "yilmaz" [EMAIL PROTECTED]
Sent: Sunday, November 25, 2001 8:02 PM
Subject: Re: number of connections keeps increasing

   I want to know environment about Java, JDBC, Servlet-Conatiner, and so
on.
   Maybe, I think you forget to close connection in JSP somewhere.

 yilmaz wrote:
 
  hi takashi,
  i don't know which jsp page exactly causes this problem,
  because i have more than 30 JSP pages in my application, and i always
  close my statements and connections after the process is finished.
  But , i think probably the problem comes from MySQL itself
  below is my MySQL environment:
 
  This Report was made using the WinMySQLadmin 1.0 Tool
 
 snip

 --
 TAKAHASHI, Tomohiro




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: number of connections keeps increasing

2001-11-25 Thread TAKAHASHI, Tomohiro
  Hi,

  How do you get JDBC Connection, named 'conn'?
  It is from Driver Manger or Connection Pooling Utility?

  Is 'conn' variable auto variable of method or instance variable of JSP?
  Generally, JSP is called from multiple threads.
  Do you lock 'conn' variable by synchronization?

  I suggest we use try-catch-finally block to close resources related to
database, and watch whether 'conn' is closed with debug message as below

  synchronized(conn) {
try {
  ...
}
catch(Excpetion ex) {
  ...
}
finally {
  try{
conn.close();
System.out.println("closed!!");
  }
  catch(Exception ex){}
}
  }
  

Thanks.

yilmaz wrote:
 
 Hi takashi,
 My environment is :
 Win2000, jdk1.3,  tomcat 4,
 Well, i am sure i added a snippet which closes statemnt and the connection.
 for example, below is the snippet from one of my pages content.jsp :
 
 % if (stmt!=null) { // actually this is a curly left brace
   stmt.close(); }  // actually this is a curly right brace
   if (conn!=null){ // stmt is a Statement object
   conn.close();  //  conn is a Connection object
   } %
 
 whenever i call this page , number of connections inreases by one
 it seems that the connections can not be closed
 Any idea or suggestions ?
 thanks a lot in advance
 best regards :)

-- 
TAKAHASHI, Tomohiro

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php