0

This code:

Array a=rs.getArray("curAccs");
ResultSet rs1=a.getResultSet();
int rs1size=rs1.getFetchSize();

return empty rs1, but a is ARRAY[221,222] I also cant convert sql array to java

(Integer[])a2.getArray()

printing

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Integer;

How to fix it?

jarlh
  • 42,561
  • 8
  • 45
  • 63
JackHuman
  • 27
  • 5

1 Answers1

0

The array contents can be retrieved with these calls:

java.sql.Array a = rs.getArray("curAccs");
Object[] values = (Object[]) a.getArray();
Integer intValA = (Integer) values[0];
Integer intValB = (Integer) values[1];
fredt
  • 24,044
  • 3
  • 40
  • 61
  • Thank you, it works element by element. But it does not work with arrays (it works on examples on the Internet) and the result set is empty, it is not clear – JackHuman Nov 23 '19 at 07:52