October 22, 2024
Chicago 12, Melborne City, USA
java

Databricks JDBC Insert into Array field


I am trying to insert some data into a databricks table which has Array fields (field1 & field2). I am using JDBC for the connection and my POJO class looks like this

public class A{
    private Long id;
    private String[] field1;
    private String[] field2;
}

I am using

jdbcTemplate.batchUpdate(String sql, final List<Object[]> batchArgs, final int[] argTypes)

where I have a list of Objects for class A.

the argtype code for the fields, field1 & field2 are 2003 since I am using the java.sql.Type.Arrray for these fields.

While executing, I am getting the following error
[Databricks][JDBC](11500) Given type does not match given object: [Ljava.lang.String;@3e1346b0.

Should I be using some other code for these fields?

How do I insert data into a Array field using JDBCTemplate



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video