Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[JDBC] Autocommit problem

From: mp.rajkhowa <mp.rajkhowa(at)nic.in>
Date: Wed Jan 09 2008 - 01:56:02 EST

hello

i am developing an applicationusing tomcat 5.5.6 and postgrsql7.3 (pg73jdbc3.jar) deployedinRedHat linux. Three days earlier updatedacolumn of particular row in a table . When iretrieved thesame row from the JSP page it was showingOK.Even when i run theselect statement for the row inpostgresql console it wasshowing updated value. Buttoday that means after 3 days when i try to viewthe row it is showing the oldvalueforthe row. When i run the select statement for the rowinposgresql console it is showing the old value. How can ithappen?Can you please help me out. My java code for theupdation isshown below.....  

        String sql = "UPDATE ........";
      Connectioncon =DBConnection.getConnection(); // DBConnectio is aclass forgetting theconnection
        Statement stmt = con.createStatement();
        // Update a row
        try {
             con.setAutoCommit(false);
             int rowsUpdated = stmt.executeUpdate(sql);
             if (rowsUpdated != 1) {
               System.out.println("Success");
            }
           con.commit();

}
finally { stmt.close();
}

with regards
Mridu Pobon Rajkhowa Received on Wed Jan 9 02:02:17 2008

This archive was generated by hypermail 2.1.8 : Wed Jun 18 2008 - 23:42:22 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library