Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 55634 invoked from network); 13 Nov 2003 03:11:07 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 13 Nov 2003 03:11:07 -0000 Received: (qmail 60707 invoked by uid 500); 13 Nov 2003 03:10:29 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 60683 invoked by uid 500); 13 Nov 2003 03:10:29 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 60670 invoked from network); 13 Nov 2003 03:10:29 -0000 Received: from unknown (HELO mx4.uniserve.ca) (216.113.192.45) by daedalus.apache.org with SMTP; 13 Nov 2003 03:10:29 -0000 Received: from [216.113.200.28] (helo=vsl.ca) by mx4.uniserve.ca with esmtp (Exim 4.22) id 1AK7sT-000NhG-W1 for tomcat-user@jakarta.apache.org; Wed, 12 Nov 2003 19:10:38 -0800 Message-ID: <3FB2F723.8040106@vsl.ca> Date: Wed, 12 Nov 2003 19:14:43 -0800 From: Vincent Aumont User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Connection timeout Problem References: <08CA2C0404E2EE42AABFD6025E4142B002A637F3@mail.promonte.com> <002501c3a98d$0410d240$0e6464c0@Celestial> Content-Type: multipart/alternative; boundary="------------040508050905010502060308" X-Scanner: OK. Scanned. X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --------------040508050905010502060308 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit MySQL drops the connection after a certain period of inactivity. Just add autoReconnect=true to you jdbc url: E.g. jdbc:mysql://localhost:3306/mydb?autoReconnect=true -Vincent. Gary Lee wrote: >My tomcat 4.1.27 connects to mysql thu. jdbc driver. >If I keep some connections overnite, i found they all got lost in the next >morning, and hence my tomcat need to restart. > >does anybody has some hint? > >Thanks > > >----- Original Message ----- >From: Veselin Kovacevic >To: Tomcat Users List >Sent: Wednesday, November 12, 2003 4:17 PM >Subject: RE: Problem with ConnectionPool on Linux > > >You think DBCP 1.1? >I try to install Tomcat 4.1.29 but I get some error with connection >pool. >Is there some changes in server.xml settings? > >-----Original Message----- >From: Kwok Peng Tuck [mailto:pengtuck@makmal.net] >Sent: Wednesday, November 12, 2003 9:13 AM >To: Tomcat Users List >Subject: Re: Problem with ConnectionPool on Linux > > >The new version of DBCP should be able to cope with this as well. I >tested it with MaxDB and it works ok. > >Veselin Kovacevic wrote: > > > >>Now, everything working fine. :) >> >>Thanks Jon. >> >> >> >> >>-----Original Message----- >>From: Jon Wingfield [mailto:jon.wingfield@mkodo.com] >>Sent: Tuesday, November 11, 2003 4:50 PM >>To: Tomcat Users List >>Subject: Re: Problem with ConnectionPool on Linux >> >> >>MySql times out idle connections. If your pool implementation doesn't >>take care of weeding out dead connections you need to add >>autoReconnect=true to your connection string. >> >>HTH, >> >>Jon >> >>Veselin Kovacevic wrote: >> >> >> >> >> >>>Hi, >>> >>>I have o problem with Tomcat 4.1.24 on SuseLinux7.3. Our application >>>has Controller servlet (below) where using connection objects from >>>connection pool. When tomcat started, application working fine and >>>everything OK that day. But next day when we try to start application >>>we get error message in isUser method (PortalUserDB class). It's first >>> >>> >>> >>> >> >> >> >>>place where we use connection object in application. Method isUser is >>>very simple method for authenticate user (below). We get this >>>exception: SQL Exception:java.sql.SQLException: No operations allowed >>>after connection closed >>> >>>Connection object is not null in this case, and this message for me is >>> >>> >>> >>> >> >> >> >>>not correct. Next, if I restart tomcat, everything working ok... (for >>>next day). >>> >>>On windows (we using windows for development platform) we have not >>>this problem. >>> >>>What is problem? >>>Is configuration server.xml or similar configuration files on Linux >>>different rather on windows? >>> >>>Note: >>>On both platform we using Tomcat 4.1.24 and j2sdk1.4.1_03. >>> >>> >>>public class Controller extends HttpServlet { >>> >>>private DataSource ds; >>> >>>public void init(ServletConfig config) throws ServletException { >>>super.init(config); >>>try { >>>InitialContext initCtx = new InitialContext(); >>>Context envCtx = >>>(Context)initCtx.lookup("java:comp/env"); >>>ds = >>>(DataSource)envCtx.lookup("jdbc/MySQLPool"); >>>} catch (Exception e){ >>>throw new UnavailableException(e.getMessage()); >>>} >>>} >>> >>>public void doGet(HttpServletRequest request, >>> >>> >>> >>> >>HttpServletResponse >> >> >> >> >>>response) >>> throws IOException, >>>ServletException { >>> >>>request.setCharacterEncoding("iso-8859-2"); >>> >>>........................ >>>........................ >>> >>>if (ds != null) { >>>Connection conn = ds.getConnection(); >>>if (conn != null) { >>>boolean isUserExists = >>>PortalUserDB.isUser(conn, userName, userPass); >>>........................ >>>........................ >>>conn.close(); >>>} >>>........................ >>>........................ >>> >>>} >>>} >>> >>>public static boolean isUser(Connection conn, String userName, String >>>userPass) >>>throws SQLException, IOException { >>> >>>String query = "SELECT user_name FROM admin_user " + >>> "WHERE user_name = ? " + >>> "AND user_pass = ?"; >>> >>>boolean isUserExists = false; >>> >>>try { >>>PreparedStatement pstmt = conn.prepareStatement(query); >>>pstmt.setString(1, userName); >>>pstmt.setString(2, userPass); >>> >>>ResultSet rs = pstmt.executeQuery(); >>> >>>isUserExists = rs.next(); >>> >>>rs.close(); >>>rs = null; >>>pstmt.close(); >>>pstmt = null; >>> >>>} catch (SQLException sqle) { >>>PortalLog.addLogLine("Class: PortalUserDB, Method: >>>isUser. SQL Exception:" + sqle, userName); >>>} >>> >>>return isUserExists; >>>} >>> >>>Thanks, >>>Veso >>> >>>--------------------------------------------------------------------- >>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org >>> >>> >>> >>> >>> >>> >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org >> >> >> >> >> >> >> >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > > > > --------------040508050905010502060308--