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

Re: "create type" custom types not supported by JDBC

From: Kris Jurka <books(at)ejurka(dot)com>
To: Roy Smith <roy(dot)smith(at)primetext(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: "create type" custom types not supported by JDBC
Date: 2007-12-01 08:39:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

On Sat, 1 Dec 2007, Roy Smith wrote:

> I'm getting errors when I'm trying to access my custom data types through 
> If I don't supply a custom map using Connection.setTypeMap() then I'm 
> getting ...
> org.postgresql.util.PGobject cannot be cast to Money at ...
> Money m = (Money) resultSet.getObject(1);  // Money is my class to handle 
> multi-currency money types

It's not clear whether your type extends PGobject or implements SQLData. 
Currently the PG driver only supports custom types via its own 
non-standard method.  You must extend PGobject and register it with the 
driver's non-standard type map via either PGConnection.addDataType() 
or via a URL paramater.

> Poking around the source code of AbstractJdbc2Connection it looks like 
> this functionality isn't support. Perhaps an "Unsupported feature" error 
> would be more helpful than a ClassCastException.

Yes, it would.  I'll take a look.

Kris Jurka

In response to


pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-12-01 09:19:17
Subject: Re: "create type" custom types not supported by JDBC
Previous:From: Kris JurkaDate: 2007-12-01 08:29:52
Subject: Re: AbstractJdbc2Array - another patch

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