From: | Dang Minh Huong <kakalot49(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | newbie question how to use java.sql.array |
Date: | 2011-07-18 13:54:14 |
Message-ID: | 4E243B06.4080000@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi every body,
I'm so sorry if this contents was posted in this mailing list.
I have to implement java.sql.array to my project now, but now it has
suspending by
following problem, any body who have experience in using java.sql.array
please help me.
many thanks for any information.
I found in JDBC documents
http://jdbc.postgresql.org/development/privateapi/org/postgresql/jdbc4/Jdbc4Array.html#free%28%29
that,
using free() method to free an java.sql.array interface, and trying to
implement to my project.
||But i could not. In postgresql jdbc does java.sql.array object needs a
free() method call to release the resoures that it hold?
I've found in org.postgresql.jdbc4Array.free() that,
public void free()
Throws SQLException
{
throw Driver.notImplemeted(getClass(),"free()");
}
so, when i tried to call it from java.sql.array object, it is returned
by the following error.
/org.postgresql.util.PSQLException/: Method
org.postgresql.jdbc4.Jdbc4Array.free() is not yet implemented
at org.postgresql.Dirver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.Jdbc4Array.free(Jdbc4Array.java:46)
at array.main(array.java:32)
I wonder if need a call free() method when the object has used, why the
return off free() method is a throw.
And the following is my simple program
...
public static void main(String[] args) throws SQLException {
String url = "jdbc:postgresql://postgresqlsv01:5555/postgres";
Properties props = new Properties();
props.setProperty("user","test");
props.setProperty("password","test");
Connection con = DriverManager.getConnection(url,props);
PreparedStatement pst = con.prepareStatement("insert into test
values (?);");
Integer[] data = {1,2,3,4,5,6,7};
java.sql.Array a = con.createArrayOf("integer",data);
try{
pst.setArray(1,a);
pst.executeUpdate();
pst.close();
}catch(Exception e){
}finally {
try{
a.free();
}
}catch(Exception ex){
e.printStackTrace();
}
}
Best regards,
Dang Minh Huong
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2011-07-18 14:33:20 | 9.1 non-devel jar |
Previous Message | Akio Iwaasa | 2011-07-15 11:28:58 | org.postgresql.jdbc4.Jdbc4Array.free() is not yet implemented |