I am using a Java class file to read data from an Excel sheet using the Apache POI API,and then using Preparedstatement to finally enter the data into database.Now I am using an insert statement in a for-loop that enters one set of data at one time.
Somewhat like this....
This process seems to take a lot of time.Data is read from the Excel sheet instantly.But it takes time to insert in to the table.Is there any way,that I store all the data in an Array/ArrayList and then finally enter them altogether,at once,instead of entering one set of data at one time? I think if it can be done,then the entire process will become much faster.
Yes. There is an executeBatchUpdate() method you can use to have less trips to the database. Depending on the size of the file, you may want to read parts of the file at a time (in a loop) so you don't have the whole file in memory.
I am not getting it.My problem is I am using an insert statement in a for-loop to enter data.I want to do the transaction at once.Let us say that I concatenate the data in a comma-separated String,or put the data in to an array and then insert it altogether.
I was trying to use ArrayDescriptor. But I am facing this weird exception
Exception encountered 1java.sql.SQLException: invalid name pattern: apps.hr_type_nom_temp
Exception encountered 3java.sql.SQLException: invalid name pattern: apps.hr_type_nom_temp