-
Notifications
You must be signed in to change notification settings - Fork 14
JDBC batch #32
Comments
No, currently there's no support for batches It will insert a series of things one after another if you pass a list of But not inside a batch Tim On 23 July 2015 at 12:54, Ryu Sasai [email protected] wrote:
|
INSERT INTO table ("name","age") VALUES (?,?),(?,?),(?,?) works with mysql but not HANA, which does not support multiple row insert. Would it be possible for you to implement batch support, please? -Uppsax |
You should be able to do INSERT INTO table ("name","age") VALUES (?,?) Then pass [['Tim',21],['Ryu',21]] No?
|
Yes, that's been perfectly working with mysql. I don't really want to call insert 100 times for 100 row insert. Therefore, I am wondering if jdbc-module will start supporting batching like -Uppsax |
I don't think it does (?,?),(?,?) It executes statements one after the other I may be wrong... Not sure when I'll get time to look into batching, I suspect it will end up
|
It will end up with the same functionality. FYI, this is the working code: int[] id = new int[] {11,22,33};
int[] ep = new int[] {1111,2222,3333};
PreparedStatement pstmt = connection.prepareStatement(
"INSERT INTO table (i,e) VALUES(?,?)");
for (int i=0; i < id.length; i++) {
pstmt.setInt(1, id[i]);
pstmt.setInt(2, ep[i]);
pstmt.addBatch();
}
pstmt.executeBatch(); If you could find time to implement it, that would be a great help, but if you busy, that's fine. I will try to pursue a workaround. |
And what happens if you do:
As that's what the the mod does |
That should be fine because each iteration inserts only one row. So, when you do
if there are 1000 arrays in 'values' array, the mod issues 1000 separate inserts?
I will review this bit in my code, because if the mod is doing the way you say, there's no reason for the mod not working with HANA. I might be doing something wrong. -Uppsax |
Yes On 23 July 2015 at 17:38, Ryu Sasai [email protected] wrote:
|
The mod is working perfectly with HANA with multiple row insert. Although, I still think that it would be better if the mod had batch insert. Could you consider implementing batch insert some time when you have time, please? -Uppsax |
Cool :-) I'll leave this issue open to remind me ;-) Wondering whether it should be a parameter to 'insert' (so that it runs all Quite like the former, as it's less work ;-) But the second route is ;-) On 24 July 2015 at 12:21, Ryu Sasai [email protected] wrote:
|
Hi Tim
Do you support jdbc batch like these?
pstmt.addBatch()
pstmt.executeBatch()
Hana does not support multiple row insert...
-Uppsax
The text was updated successfully, but these errors were encountered: