oracleStmt.setArray(1, oracleArray);
Integer index = stmt.getBindingVariable(name);  if (index == null) return false;  int i = index.intValue(); Object object = varArray.toJavaObject();  if (object instanceof OracleOciCollection) { oracleArray = ((OracleOciCollection) object).getCollection(); oracleStmt.setArray(i, oracleArray); } else if (varArray instanceof ArrayValueImpl) {    oracleStmt.setArray(i, oracleArray); } else { oracleStmt.setObject(i, object); }
  public static boolean oci_bind_array_by_name(Env env,                                               @NotNull OracleStatement stmt,                                               @NotNull String name,                                               @NotNull ArrayValue varArray,                                               @NotNull int maxTableLength,                                               @Optional("0") int maxItemLength,                                               @Optional("0") int type)  {    try {      PreparedStatement oracleStmt = stmt.getPreparedStatement();      java.sql.Connection conn = ((UserConnection) oracleStmt.getConnection()).getConnection();      // Create an oracle.sql.ARRAY object to hold the values      // oracle.sql.ArrayDescriptor arrayDesc =      //   oracle.sql.ArrayDescriptor.createDescriptor("number_varray", conn);      Class clArrayDescriptor = Class.forName("oracle.sql.ArrayDescriptor");      Method method = clArrayDescriptor.getDeclaredMethod("createDescriptor",                                           new Class[] {String.class, java.sql.Connection.class});      Object arrayDesc = method.invoke(clArrayDescriptor, new Object[] {"NUMBERVARRAY", conn});      Value keyArray[] = varArray.getKeyArray(); // int arrayValues[] = {123, 234};      // oracle.sql.ARRAY array = new oracle.sql.ARRAY(arrayDesc, conn, arrayValues);      Class clARRAY = Class.forName("oracle.sql.ARRAY");      Constructor constructor = clARRAY.getDeclaredConstructor(new Class[] {        clArrayDescriptor, Connection.class, Object.class});      Array oracleArray = (Array) constructor.newInstance(new Object[]        {arrayDesc, conn, keyArray});      // Bind array      // ((oracle.jdbc.driver.OraclePreparedStatement)oracleStmt).setARRAY(1, array);      // cl = Class.forName("oracle.jdbc.driver.OraclePreparedStatement");      // method = cl.getDeclaredMethod("setARRAY",      //                              new Class[] {Integer.TYPE, Object[].class});      if (name.startsWith(":")) {        name = name.substring(1);      }      // method.invoke(oracleStmt, new Object[] {name, oracleArray});      oracleStmt.setArray(1, oracleArray);      // drop descriptor ???? 'number_varray' ????      return true;    } catch (Exception e) {      log.log(Level.FINE, e.toString(), e);      return false;    }  }