Tomcat problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Tomcat problem

  1. #1
    Join Date
    Nov 2005
    Posts
    10

    Tomcat problem

    i am using tomcat 4.12 and sql server 2000...

    while multiple users accessing our application, each page takes time to load...

    i have checked task manager. before loading the page, the tomcat usage is 70 MB, once the page is loaded the usage is keep on increasing...

    after unloading the page, tomcat usage is not decreased..

    what should i do for that ? how to check the sql server open cursor?

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    255
    how to check the sql server open cursor?

    One way of ensuring that all cursors are taken care of, is to call the close() method on ResultSet, Statement (includes PreparedStatement and CallableStatement) and Connection objects. generally, calling close() on Connection objects ensures that the DB cursors are closed but it is good practice to close the statements and resultsets when they are not required any further in the code. This releases some of the system resources.

    I usually follow an approach where a DBUtil class (utility class for database related stuff) is used to close the resources
    Code:
    import java.sql.*;
    
    public class DBUtil {
        public static void close(Connection conn) {
            try {
                if(conn != null && !conn.isClosed())  conn.close();
            } catch(SQLException sqle) {
                // Log the exception.
            }
        }
    
        public static void close(Statement stmt) {
            try {
                if(stmt != null)  stmt.close();
            } catch(SQLException sqle) {
                // Log the exception.
            }
        }
    
        public static void close(ResultSet rs) {
            try {
                if(rs != null)  rs.close();
            } catch(SQLException sqle) {
                // Log the exception.
            }
        }
    
        /* Other utility methods */
    
    }
    The static overloaded close() methods are called in a finally block in the code to ensure that all the resources get closed before the code block completes execution.
    Happiness is good health and a bad memory.

Similar Threads

  1. Installing an application in tomcat
    By Flash in forum Web
    Replies: 1
    Last Post: 03-13-2002, 07:29 AM
  2. Tomcat Startup Problem
    By Jose Rodz in forum Web
    Replies: 0
    Last Post: 12-27-2001, 08:26 AM
  3. Using Tomcat 4.x on Windows with IIS
    By David in forum Java
    Replies: 0
    Last Post: 10-27-2001, 04:55 AM
  4. Replies: 0
    Last Post: 06-23-2000, 02:17 PM
  5. Arabic problem view
    By Ayman in forum VB Classic
    Replies: 8
    Last Post: 04-03-2000, 08:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center