pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Poul Møller Hansen <freebsd@pbnet.dk>
To: pgsql-jdbc@postgresql.org
Subject: CachedRowSetXImpl() and PostgreSQL
Date: Thu, 21 Sep 2006 16:02:44 +0200
Message-ID: <45129B84.9000208@pbnet.dk> (raw)

I am having some trouble getting CachedRowSetXImpl() to work with 
postgresql-8.1-407.jdbc3.jar in
this part of a SessionBean

CachedRowSetXImpl crsx = new CachedRowSetXImpl();
crsx.setDataSourceName("java:comp/env/jdbc/MyDataSource");
crsx.setTableName("table");
crsx.setCommand("SELECT ALL id, url FROM my.table ");


Getting the data is no problem, but when updating it's not using the 
correct tablename
I have tried crsx.setTableName("my.table");
But then I get a "No columns in table" as this statement will not find 
the table "my.table":
-----
SELECT 
n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,def.adsrc,dsc.description  
FROM pg_catalog.pg_namespace n  JOIN pg_catalog.pg_class c ON 
(c.relnamespace = n.oid)  JOIN pg_catalog.pg_attribute a ON 
(a.attrelid=c.oid)  LEFT JOIN pg_catalog.pg_attrdef def ON 
(a.attrelid=def.adrelid AND a.attnum = def.adnum)  LEFT JOIN 
pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = 
dsc.objsubid)  LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid 
AND dc.relname='pg_class')  LEFT JOIN pg_catalog.pg_namespace dn ON 
(dc.relnamespace=dn.oid AND dn.nspname='pg_catalog')  WHERE a.attnum > 0 
AND NOT a.attisdropped  AND c.relname LIKE 'my.table'  AND a.attname 
LIKE 'id'  ORDER BY nspname,relname,attnum
-----

It should have used the name "table" instead of "my.table"
Without the schema name, I get a "relation not found.

Then I tried adding this:
crsx.setSchemaName("my");

But then It stops in an exception with no error message right after 
setting transaction level:
-----
StandardContext[/MyApp]Error Description
java.lang.RuntimeException
    at 
com.sun.data.provider.impl.CachedRowSetDataProvider.commitChanges(CachedRowSetDataProvider.java:878)
-----

How is it possible getting it to work ?


Thanks,
 Poul





view thread (8+ messages)  latest in thread

Message-ID: <45129B84.9000208@pbnet.dk>
Permalink:  ../45129B84.9000208@pbnet.dk/
Also on:    postgresql.org/message-id/45129B84.9000208@pbnet.dk

 · 

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: freebsd@pbnet.dk
  Subject: Re: CachedRowSetXImpl() and PostgreSQL
  In-Reply-To: <45129B84.9000208@pbnet.dk>
  References: <45129B84.9000208@pbnet.dk>

* 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