English 中文(简体)
使用 JDBC 获取后gressql 阵列
原标题:Retrieving postgresql arrays using JDBC

我有一张像这样的桌子

  list     |  id  | 
-----------+--------
 {930,23}  |  1   |
 {2012,1}  |  2   |
 {5943}    |  3   |
 {6148}    |  4   |
 {1003}    |  5   |

现在,我愿意使用JDBC来检索第一栏。我学到了我们可以使用 java.sql. Array 来做到这一点。 (http://docs.oracle.com/javase/tument/jdbc/basics/rary.html#retrieving_ray ),但当我宣布Array 对象为:

import java.sql.Array;

while(rs.next())
    Array arr;

它发出汇编错误:

[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]                   ^

Java似乎没有认出数据类型 Java.sql.Array。有人知道原因吗?非常感谢!

最佳回答

您应使用括弧括号与语句:

while (rs.next()) {
    Array arr;  // Add more code here.
}
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签