Hello Daniel
     actually i made a class file for connection and i take an object of
the class MyCon and the method of the class getCon() returns statement.
now in this way i have to write a method in this class to commit my all
transaction
and have to call it from my jsp
m i right?
will it work fine?
i am new in jsp
see the code
when i take connection and statement static in method it works fine
package pkgs;
import java.lang.*;
import java.sql.*;
public class MyCon{
     public static Statement getCon(){
          Connection con=null;
          Statement stmt=null;
          try{
               Class.forName("com.informix.jdbc.IfxDriver");
          }
          catch(Exception e){
               System.out.println("Error 1");
               System.out.println(e);
          }
          try{
               con=DriverManager.getConnection(CONSTR);
               stmt = con.createStatement();
          }
          catch(Exception e){
               System.out.println("Error 2");
               System.out.println(e);
          }
          return stmt;
     }
}

BUT THIS IS ---NOT--- WORKING AND GIVING ERROR FOR RESPONSE HAS BEEN
COMMITED
package pkgs;
import java.lang.*;
import java.sql.*;
public class MyCon{
     Connection con=null;
     Statement stmt=null;
     public Statement getCon(){
          try{
               Class.forName("com.informix.jdbc.IfxDriver");
          }
          catch(Exception e){
               System.out.println("Error 1");
               System.out.println(e);
          }
          try{
               con=DriverManager.getConnection(CONSTR);
               stmt = con.createStatement();
          }
          catch(Exception e){
               System.out.println("Error 2");
               System.out.println(e);
          }
          return stmt;
     }
}

Why this happening?
Thanks
Vaishali
Relience Ind Ltd
A'bad

Hi Vaishali ,

Try setting

con.setAutoCommit(false);

after setting connection

then after doing every transaction works just
say

con.commit();

IF it works mail me else mail me the Error Details

(I am also from India)
Regards
E.Daniel Jayapaul
Java Team Leader
Mustang Technologies Co., Ltd.
99/29, Moo 4,Chaengwattana Road
Klong Gleua,Pakkred
Nonthaburi 1120,Thailand
http://www.mustang-technologies.com
Tel:   662 583 6161 -5
Fax:  662 583 6535

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to