Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    Philippines
    Posts
    5

    Unanswered: Batch update in DB2 using Java

    Hi,

    Im currently developing a web application that utilizes Java and DB2 on as/400. The problem is when i used batch transaction in updating,inserting or deleting data , consider the code below:

    String sSQL = "INSERT INTO tblTest VALUES(?,?)"
    try{

    con.setAutoCommit(false);

    PreparedStatement pstmt = con.prepareStatement(sSQL);

    pstmt.setInt(1,123456);
    pstmt.setString(1,"Jimbo");

    pstmt.addBatch();

    pstmt.setInt(1,234567);
    pstmt.setString(1,"Stifler");

    pstmt.addBatch();

    pstmt.executeBatch();

    con.setAutoCommit(true);

    } catch (SQLException e) {
    try{
    con.rollback();
    } catch (SQLException e2) {
    }
    }


    when executed it gives "The table tblTest is not valid for operation ". Does the driver im using doesnt support transaction?

    Thx,
    Marlon Cenita

  2. #2
    Join Date
    Nov 2003
    Posts
    14
    which driver is you using ??

  3. #3
    Join Date
    Dec 2003
    Location
    Philippines
    Posts
    5
    Originally posted by richardluopeng
    which driver is you using ??
    Im using jt400.jar or the IBM Toolbox for Java!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •