Link to home
Start Free TrialLog in
Avatar of rospcc
rospcc

asked on

JDBC and Oracle load testing

Hi All,

We are doing load testing for our jsp application running in Resin and Oracle 9i. The load testing tool that we are using is JBlitz.  When we set the concurrent user to 1, our application can run smoothly i.e. the number of cursors remain as 1. But, once we set the concurrrent user to 2, the number of cursors keeps on rising.

Here's snippet of the codes

sqlMethod class
                     public static synchronized ResultSet rsQuery(String sql)
        {
              try
              {
                    con=ConnectionBean.getConnection();
                    st=con.createStatement();
                    rs=st.executeQuery(sql);
       
                }
              catch(Exception e)
              {
                     System.out.println("sqlMethod rsQuery is abnormal"+e);
              }
              finally
              {
                    close();
              }
              return rs;
        }

                      public static  synchronized void close()
        {
              try
              {
                    if (con != null) {
                          ConnectionBean.close();
                    }
              }
              catch(Exception er)
              {
                    System.out.println("con='" + con + "' close is abnormal "+er);
              }

        }

                    public static  synchronized void closeStmt()
        {
              try
              {
                    //System.out.println("Statement='" + st + "'");
                    if (st != null) {
                           st.close();
                           st = null;
                    }
              }
              catch(Exception er)
              {
                    System.out.println("st='" + st + "' close is abnormal "+er);
              }

        }




ConnectionBean class:
 public static synchronized void close() throws Exception
  {
    if (con != null)
    {
             con.close();
             con = null;
             System.out.println("Connection.close() = '"+con+"'");
        }
  }


Example of methods that uses the connection:
Vector v = new Vector();
         
       String querySql = "SELECT * FROM QType ORDER BY SEQUENCE";      
       
        try
        {          
            ResultSet rs=sqlMethod.rsQuery(querySql);      
                       
            while(rs.next())
            {
                  voQType vo = new voQType();
                  vo.setPKQType(rs.getInt("PKQType"));
                  vo.setQType(rs.getString("QType"));
                 
                  v.add(vo);
            }
           rs.close();
           rs = null;
        }
        catch(Exception E)
        {
           
            System.err.println("Q.java - getQTypes - " + E);
        }
        finally
        {
              sqlMethod.close();
              sqlMethod.closeStmt();
        }
        return v;



Any suggestions on how to improve the codes?

Thank you.
SOLUTION
Avatar of Gibu George
Gibu George
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial