CachedRowSetXImpl() and PostgreSQL - Mailing list pgsql-jdbc

From Poul Møller Hansen
Subject CachedRowSetXImpl() and PostgreSQL
Date
Msg-id 45129B84.9000208@pbnet.dk
Whole thread Raw
Responses Re: CachedRowSetXImpl() and PostgreSQL  (Poul Møller Hansen <freebsd@pbnet.dk>)
List pgsql-jdbc
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



pgsql-jdbc by date:

Previous
From: Alex Stienstra
Date:
Subject: ResultSetMetaData.getTableName() == null
Next
From: Poul Møller Hansen
Date:
Subject: Re: CachedRowSetXImpl() and PostgreSQL