java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters, when using CachedRowSetImpl - Mailing list pgsql-jdbc

From
Subject java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters, when using CachedRowSetImpl
Date
Msg-id 003101c58863$cb9e3490$cda90554@freeman
Whole thread Raw
List 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 ?
 
 
 

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Multiple Statement result set problem with PreparedStatements
Next
From: Greg Alton
Date:
Subject: Inserting a large number of records