Hi!
I am currently developing an application that parses text files and inserts the found records into a Microsoft Access database. At the moment, I am trying to tune it's performance somewhat, and among other things I wish to perform these inserts in batches instead of separate queries.
I wrote a simple if statement with a counter that executed the batch every for every n:th command, but I soon realized that it didn't work very well. The execution stops after what I at first thought to be a random number of queries, but after printing all queries I noticed that it always stops when reaching an insert statement for a different table.
For example, let's say I have a batch of five queries that I want to execute.
INSERT INTO [Table1] VALUES ( 1, 'Some value' )
INSERT INTO [Table1] VALUES ( 2, 'Some value' )
INSERT INTO [Table1] VALUES ( 3, 'Some value' )
INSERT INTO [Table2] VALUES ( 4, 'Some value' )
INSERT INTO [Table2] VALUES ( 5, 'Some value' )
When calling executeBatch() it will successfully insert rows 1, 2 and 3 into Table1, but then it will stop. That is, the returning array of ints only has a length of three, instead of the expected five.
Any ideas of how to solve this?
Best regards,
Erik Brännström