I have a table like this
list | id |
-----------+--------
{930,23} | 1 |
{2012,1} | 2 |
{5943} | 3 |
{6148} | 4 |
{1003} | 5 |
Now, I'd like to use JDBC to retrieve the first column. I've learned that we can use java.sql.Array to do that. (http://docs.oracle.com/javase/tutorial/jdbc/basics/array.html#retrieving_array), but when I declare the Array object like this:
import java.sql.Array;
while(rs.next())
Array arr;
It issues a compile error:
[javac] /home/xxx.java:291: error: not a statement
[javac] Array arr;
[javac] ^
[javac] /home/xxx.java:291: error: ';' expected
[javac] Array arr;
[javac] ^
[javac] /home/xxx.java:291: error: not a statement
[javac] Array arr;
[javac] ^
It seems that Java is not recognizing the data type java.sql.Array. Anyone knows why? Thanks a lot!
You should use curly brackets with your while statements:
while (rs.next()) {
Array arr; // Add more code here.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With