newbie question how to use java.sql.array

Поиск
Список
Период
Сортировка
От Dang Minh Huong
Тема newbie question how to use java.sql.array
Дата
Msg-id 4E243B06.4080000@gmail.com
обсуждение исходный текст
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Akio Iwaasa
Дата:
Сообщение: Re: org.postgresql.jdbc4.Jdbc4Array.free() is not yet implemented
Следующее
От: David Fetter
Дата:
Сообщение: Copyright notices