java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters, when using CachedRowSetImpl

From: <xavier(dot)marquis(at)cegetel(dot)net>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters, when using CachedRowSetImpl
Date: 2005-07-14 11:04:24
Message-ID: 003101c58863$cb9e3490$cda90554@freeman
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I use PostgreSQL 8.0.3 and following associated drivers :

postgresql-8.0-311.jdbc2.jar
postgresql-8.0-311.jdbc2ee.jar
postgresql-8.0-311.jdbc3.jar

I want to use CachedRowSetImpl to populate one row in the following table :

CREATE TABLE "Form2"
(
form2member3 int4,
form2member5 int8[],
)
WITHOUT OIDS;

I have inserted a row using pgAdmin into the good table.

Now, I simply try to populate the row :

public class Main2 {

public static void main(String[] args) {
try
{
DriverManager.registerDriver(new org.postgresql.Driver());
String SQLRequest="SELECT form2member3,form2member5::int8[] from \"Form2\";
CachedRowSet cached_row = new CachedRowSetImpl();
cached_row.setUrl("jdbc:postgresql://localhost:5432/myBDD");
cached_row.setUsername("postgres");
cached_row.setPassword("postgres");
cached_row.setCommand(SQLRequest);
cached_row.execute();

Object test = cached_row.getArray("form2member5");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

And I receive the following exception :

java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters
at javax.sql.rowset.serial.SerialArray.<init>(SerialArray.java:124)
at com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:641)
at com.sun.rowset.internal.CachedRowSetReader.readData(CachedRowSetReader.java:170)
at com.sun.rowset.CachedRowSetImpl.execute(CachedRowSetImpl.java:736)
at com.sun.rowset.CachedRowSetImpl.execute(CachedRowSetImpl.java:1385)
at Main2.main(Main2.java:34)

Does someone know where I am wrong, and what I must do to make it work ?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Greg Alton 2005-07-14 14:15:32 Inserting a large number of records
Previous Message Lenard, Rohan (Rohan) 2005-07-14 02:34:23 Re: Multiple Statement result set problem with PreparedStatements ?