This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Error during large batch insertion for preparedstatement (395 parameters) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error during large batch insertion for preparedstatement (395 parameters)" Watch "Error during large batch insertion for preparedstatement (395 parameters)" New topic
Author

Error during large batch insertion for preparedstatement (395 parameters)

Sean Chang
Greenhorn

Joined: Feb 12, 2009
Posts: 12
Hi,

I am using db2 and jdbc preparedstatements in java to insert a large number of columns (395 parameters in this example), and I have about 20 other tables with similar column sizes, and are inserting in a batch. I am getting an error when trying to do this, is there a limitation to the number of parameters I can use?

Here is some sample code
values[395] (this is loaded earlier in the program to 395 items), and the preparedstatement is also 395



--

I am getting the following error from this
2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:483) - Contents of BatchUpdateException:
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:484) - Update counts:
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:487) - Statement 0:-3
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:489) - Message: Non-atomic batch failure. The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:490) - SQLSTATE: null
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:491) - Error code: -99999
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:494) - SQL exception:
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:495) - Message: Error for batch element #0: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:496) - SQLSTATE: 22001
[2009-08-26 20:43:32,326 main] ERROR (DicomManager.java:497) - Error code: -302


Anyone know if this is a limitation of preparedstatments, and if so, what is a possible other solution to this
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

It appears one of your sql queries has a problem which is causing the batch not to commit correctly


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error during large batch insertion for preparedstatement (395 parameters)
 
Similar Threads
getNextException SQLGrammarException
Could not synchronize database state with session
Solution for problems occured during mediation process configuration in jbilling
Hibernate exception - could not insert
ConstraintViolationException in Hibernate