OPERATION NOT ALLOWED AFTERRESULT SET IS CLOSED"
the problem is
in my project, i have few pages it will be view by more then one person through intrenet. when one are more person trying to access the same page at the same time, one person is getting "OPERATION NOT ALLOWED AFTERRESULT SET IS CLOSED" error
i had used jsp servlet and bean file in my project
here by i had send my bean file used for database connection
package com.pts.database;
import java.io.*;
import java.sql.*;
import java.net.*;
public class DBCon
{
private static final String DriverClass = "com.mysql.jdbc.Driver";
private static final String CONNECTION_STRING = "jdbc:mysql://";
private static final String PORT = "3306";
private static final String DATABASE = "opts";
private static final String user = "dav";
private static final String pwd="";
private static Connection con = null;
private static Statement stmt = null;
private static Statement stmt2 = null;
private static PreparedStatement pst = null;
private static ResultSet rs = null;
private static int count = 0;
public static void assignCon()
{
// String CONNECTION_IP="";
//try{
// InetAddress ia = InetAddress.getLocalHost();
//CONNECTION_IP=ia.getHostAddress ();
String CONNECTION_IP="100.100.100.6";
//System.out.println("inside servlet DBCon file");
// System.out.println("u r database IP is "+CONNECTION_IP);
//}catch(UnknownHostException ue){System.out.println(ue);}
try{
Class.forName(DriverClass).newInstance();
}
catch(ClassNotFoundException ce){System.out.println (ce);}
catch(InstantiationException ie){}
catch(IllegalAccessException ie1){}
try
{
con = DriverManager.getConnection(CONNECTION_STRING+CONN ECTION_IP+":"+PORT+"/"+DATABASE,user,pwd);
stmt = con.createStatement();
stmt2 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSIT IVE,ResultSet.CONCUR_READ_ONLY);
}catch(SQLException sqle){System.out.println("STMT:"+sqle);}
}
public static ResultSet retrieveFromDB(String sql) throws SQLException
{
return (stmt.executeQuery(sql));
}
public static ResultSet retrieveScrollDB(String sql) throws SQLException
{
return (stmt2.executeQuery(sql));
}
public static int updateDB(String sql) throws SQLException
{
return (stmt.executeUpdate(sql));
}
public static PreparedStatement prepareStmt(String sql) throws SQLException{
pst=con.prepareStatement(sql);
return pst;
}
public static ResultSet getProjectsList() throws SQLException{
rs=((PreparedStatement)con.prepareStatement("selec t projID,projName from proj_det where delFlag=0 || delFlag IS NULL")).executeQuery();
return rs;
// public staic ResultSet getProjectList() Throws
}
public static Connection getConn() {
return con;
}
public static Statement getStmt()
{
return stmt;
}
public static void closeAll() throws SQLException
{
rs.close();
stmt.close();
stmt2.close();
con.close();
}
}
tellme where to change the code
my database is mysql 4.0
driver is com.mysql.jdbc.Driver
server is Tomcat5.0
bye
with regards
prakash
|