I am sorry , the error occurs even when finally section is removed from the 
Bean class

thanx
Venki

"venkitachalam_s81" wrote : I get the follwoing error when trying to access 
session EJB from jsp 
  | 
  | " Connection handle has been closed and is unusable "
  | 
  | My EJB would look like
  | 
  | public class userReport implements SessionBean 
  | {
  | 
  |     private Connection con = null;  
  |     
  |     public void makeConnection() throws 
RemoteException,NamingException,SQLException 
  |     {
  |             try
  |             {
  |                     InitialContext ic =null;
  |                     DataSource ds = null;                           
  |                     con = null;
  |                     ic = new InitialContext();              
  |                     ds = (DataSource) ic.lookup("java:jdbc/SybaseDB");      
                
  |                     con = ds.getConnection();
  |             }
  |             catch(Exception e)
  |             {
  |                     con.close();
  |                     System.out.println(e);
  |             }
  |             finally
  |             {
  |                     con.close();
  |             }
  |     }       
  |     .........
  |                 ..........
  | public int insertAccounts(String[] reportParams) throws 
RemoteException,NamingException,SQLException 
  |     {                       
  |             Vector accVector = new Vector();                
  |             try
  |             {
  |                     PreparedStatement ls_stmt = null;
  |                     int result = 0;
  |                     ls_stmt = con.prepareStatement("exec 
prc_mis_report_accs_ins ?");                       
  |                     for(int j=0;j< reportParams.length;j++)
  |                     {                               
  |                             ls_stmt.setString(1,reportParams[j]);
  |                             result = ls_stmt.executeUpdate();
  |                     }
  |             }
  |             catch(SQLException e)
  |             {
  |                     con.close();
  |                     System.out.println(e);
  |                     return 0;
  |             }
  |             catch(Exception e)
  |             {
  |                     con.close();
  |                     System.out.println(e);
  |                     return 0;                       
  |             }
  |             return 1;
  |     }       
  |                 .............
  |                 ...............
  | }
  | 
  | and jsp would be
  | 
  | objRemote.makeConnection();
  | 
  | String[] reportParams = request.getParameterValues("income_acc");
  | ret_value = objRemote.insertAccounts(reportParams);
  | 
  | but after makeConnection() I get the error as above.
  | 
  | 
  | Please Help........
  | 
  | 
  | Thanx
  | Venki
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884333#3884333

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884333


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to