Skip site navigation (1) Skip section navigation (2)

CachedRowSetXImpl() and PostgreSQL

From: Poul Møller Hansen <freebsd(at)pbnet(dot)dk>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: CachedRowSetXImpl() and PostgreSQL
Date: 2006-09-21 14:02:44
Message-ID: 45129B84.9000208@pbnet.dk (view raw or flat)
Thread:
Lists: 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



Responses

pgsql-jdbc by date

Next:From: Poul Møller HansenDate: 2006-09-21 19:42:42
Subject: Re: CachedRowSetXImpl() and PostgreSQL
Previous:From: Alex StienstraDate: 2006-09-21 10:18:16
Subject: ResultSetMetaData.getTableName() == null

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group