Created
July 23, 2020 07:17
-
-
Save saswata-dutta/e41781cc9f5c56612d2097dd8efb1e7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<List<String>> rows = ordered list of values per row. | |
connection con.setAutoCommit(false); | |
PreparedStatement prepStmt = con.prepareStatement( | |
"insert statement for 1 row with exact ? for place holders"); | |
for row in rows: | |
for col_i in row.size: | |
prepStmt.setString(col_i, row[col_i]) | |
prepStmt.addBatch() | |
int [] numInserts=prepStmt.executeBatch(); | |
assert(numInsets and rows.size) | |
con.commit() (or rollback ...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment