I want to insert a set of arrays into a database(HANA) in a loop.My code is below:
public class jdemo {
public static void main(String[] args) {
Connect
The topic of "ARRAY inserts into HANA" has been discussed a couple of times here on SO already. HANA only supports to store arrays via the ARRAY() function. This function does not take a list as the parameter, but only separate elements.
So, instead of
String sql="INSERT INTO TABLE1 VALUES(1,ARRAY(?))"
you would have to write
String sql="INSERT INTO TABLE1 VALUES(1, ARRAY( 1, 2, 3))"
For the JDBC driver: HANA JDBC doesn't automatically handle JAVA arrays to HANA arrays - that's something the developer will have to do manually. (yes, it's not nice, I know).
In short: currently (HANA 1.0 SP12) arrays can basically be used internally (within a stored procedure), but they are not first-class-citizen data types. (<- that's my opinion!)