This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes Having trouble with executeBatch Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Having trouble with executeBatch" Watch "Having trouble with executeBatch" New topic
Author

Having trouble with executeBatch

Reggie McDougal
Ranch Hand

Joined: Sep 27, 2004
Posts: 69
For some reason execute batch will not update the database, now I have tried testing the batch with a ps.setString (1, "testData") and still no cigar, it looks right to me I just can't see why the database is not updating.

error is an ArrayList by the way.



You can never drink too much
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
I believe setString wants a 0-indexed number as its parameter. So, you should be giving it a 0 instead of 1 -- unless I'm misunderstanding something here ....


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Hi Reggie,
I think you should add this after you get database connection..



And Nathaniel, according to JDBC Specification, the setting parameter always start with 1 instead of 0-index.

Correct me if I am wrong...
Hope this help
daniel
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26192
    
  66

Daniel is correct. JDBC uses indexes starting with 1.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Having trouble with executeBatch
 
Similar Threads
want to delete the record
Prepared Statement problem in my servlet's data manager
ORA-00972: identifier is too long
executeBatch() not executing
Out of Sync error