안녕하세요..
Array 입력하기 너무 힘드네요. 5시간도안 구글링 하다가 포기하고 질문 올립니다.
Create Table Test(
name vachar(50)[]
)
이런 테이블에 name을 입력하는 겁니다.
DBConnection dbc = null;
CallableStatement cs = null;
java.sql.Array array = null;
try {
dbc = new DBConnection();
Connection con = dbc.getConnection();
cs = con.prepareCall("{ call insert_group_value(?,?,?) }");
cs.setString(1, "aquua");
cs.setString(2, "maillist");
array = con.createArrayOf("int4", new String[] { "a","b"});
cs.setArray(3, sqlArray);
cs.executeUpdate();
} catch (Exception e) {
System.out.println(e.toString());
} finally {
DbUtils.closeQuietly(cs);
if(dbc!=null) dbc.release();
}
구글 검색 결과 빨간색 표시한 글씨처럼 하면 된다고 하는데
문제는 array 가 null 이 나옵니다.
array를 입력할 수 만 있으면 나머지 function에서는 어떻게 해 볼 수 있겠는데.. 영 안 되네요..
DB 버전은 "PostgreSQL 8.4.4, compiled by Visual C++ build 1400, 32-bit"
JDBC 버전은 postgresql-8.4-702.jdbc4.jar 입니다.
|