Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2006, 05:36 AM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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







Similar Threads
Thread Thread Starter Forum Replies Last Post
Operation is not allowed when the object is closed lightmaker Classic ASP Basics 1 June 6th, 2008 12:29 PM
Operation is not allowed when the object is closed kingroon Classic ASP Databases 2 February 5th, 2008 10:29 AM
"OPERATION NOT ALLOWED AFTERRESULT SET IS CLOSED" picky JSP Basics 3 October 12th, 2006 03:26 PM
Operation is not allowed when the object is closed kah Javascript How-To 2 February 16th, 2005 07:20 AM
operation is not allowed when object is closed shoakat Classic ASP Databases 1 November 26th, 2004 12:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.