If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Batch update in DB2 using Java

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-03-04, 00:52
mcenita mcenita is offline
Registered User
 
Join Date: Dec 2003
Location: Philippines
Posts: 5
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
Reply With Quote
  #2 (permalink)  
Old 02-03-04, 03:48
richardluopeng richardluopeng is offline
Registered User
 
Join Date: Nov 2003
Posts: 14
which driver is you using ??
Reply With Quote
  #3 (permalink)  
Old 02-03-04, 20:06
mcenita mcenita is offline
Registered User
 
Join Date: Dec 2003
Location: Philippines
Posts: 5
Quote:
Originally posted by richardluopeng
which driver is you using ??
Im using jt400.jar or the IBM Toolbox for Java!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On