pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: xavier.marquis@cegetel.net
To: pgsql-jdbc@postgresql.org
Subject: java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters, when using CachedRowSetImpl
Date: Thu, 14 Jul 2005 13:04:24 +0200
Message-ID: <003101c58863$cb9e3490$cda90554@freeman> (raw)

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 ?

view thread (2+ messages)  latest in thread

Message-ID: <003101c58863$cb9e3490$cda90554@freeman>
Permalink:  ../003101c58863$cb9e3490$cda90554@freeman/
Also on:    postgresql.org/message-id/003101c58863$cb9e3490$cda90554@freeman

 · 

reply

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: xavier.marquis@cegetel.net
  Subject: Re: java.sql.SQLException: Cannot instantiate a SerialArray object with null parameters, when using CachedRowSetImpl
  In-Reply-To: <003101c58863$cb9e3490$cda90554@freeman>
  References: <003101c58863$cb9e3490$cda90554@freeman>

* 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