From: Dang Minh Huong <kakalot49@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: newbie question how to use java.sql.array
Date: Mon, 18 Jul 2011 22:54:14 +0900
Message-ID: <4E243B06.4080000@gmail.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: kakalot49@gmail.com
Subject: Re: newbie question how to use java.sql.array
In-Reply-To: <4E243B06.4080000@gmail.com>
References: <4E243B06.4080000@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox