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.getConn ection();
st=con.createStatement();
rs=st.executeQuery(sql);
}
catch(Exception e)
{
System.out.println("sqlMet hod 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("Stat ement='" + 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("Connec tion.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(query Sql);
while(rs.next())
{
voQType vo = new voQType();
vo.setPKQType(rs.getInt("P KQType"));
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.
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.getConn
st=con.createStatement();
rs=st.executeQuery(sql);
}
catch(Exception e)
{
System.out.println("sqlMet
}
finally
{
close();
}
return rs;
}
public static synchronized void close()
{
try
{
if (con != null) {
ConnectionBean.close();
}
}
catch(Exception er)
{
System.out.println("con='"
}
}
public static synchronized void closeStmt()
{
try
{
//System.out.println("Stat
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("Connec
}
}
Example of methods that uses the connection:
Vector v = new Vector();
String querySql = "SELECT * FROM QType ORDER BY SEQUENCE";
try
{
ResultSet rs=sqlMethod.rsQuery(query
while(rs.next())
{
voQType vo = new voQType();
vo.setPKQType(rs.getInt("P
vo.setQType(rs.getString("
v.add(vo);
}
rs.close();
rs = null;
}
catch(Exception E)
{
System.err.println("Q.java
}
finally
{
sqlMethod.close();
sqlMethod.closeStmt();
}
return v;
Any suggestions on how to improve the codes?
Thank you.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.