From: | Marc Mamin <M(dot)Mamin(at)intershop(dot)de> |
---|---|
To: | "'pgsql-jdbc(at)postgresql(dot)org'" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | JDBC & custom type of variable types (!) |
Date: | 2013-11-27 09:04:15 |
Message-ID: | B6F6FD62F2624C4C9916AC0175D56D880CE4B473@jenmbs01.ad.intershop.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hello,
I'd like to retrieve a custom type from a result set,
but problem: I don't know exactly the structure.
It may be float/text or int/text, so I'd need to map it to one of those java custom types:
deciType <Double,String>;
intType <Long, String>;
Can I rely on a ClassCastException as below to find the correct matching?
even when the custom type has NULL(s) in it ?
Or is there a better approach ?
case Types.STRUCT:
try
{
foo = (intType)resultset1.getObject(1);
}
catch (ClassCastException e)
{
blah = (deciType)resultset1.getObject(1);
}
(Postgres 9.3 , JDBC4 Postgresql Driver, Version 9.3-1100)
many thanks,
Marc Mamin
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2013-11-27 14:02:28 | Re: JDBC & custom type of variable types (!) |
Previous Message | Dave Cramer | 2013-11-25 13:53:05 | Re: DatabaseMetaData - schemaPattern |