pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feed[GENERAL] JDBC +CIDR (fwd)
3+ messages / 2 participants
[nested] [flat]
* [GENERAL] JDBC +CIDR (fwd)
@ 2004-10-21 18:27 Kris Jurka <books@ejurka.com>
2004-10-21 20:45 ` Re: [GENERAL] JDBC +CIDR (fwd) Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 3+ messages in thread
From: Kris Jurka @ 2004-10-21 18:27 UTC (permalink / raw)
To: pgsql-jdbc
What kind of solution can we offer for this problem? Do we really need to
make PGobject extensions for every type? Do we really want to force
people to have to create these for all user defined types?
Kris Jurka
---------- Forwarded message ----------
Date: Tue, 12 Oct 2004 17:54:41 +0200
From: Johann Robette <jrobette@onyme.com>
To: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: [GENERAL] JDBC +CIDR
Hi,
I've a table containing a CIDR field.
I'm using an EJB to create a new record in this table.
I don't know how to pass the CIDR value. I tried by String but I get
this error :
javax.ejb.FinderException: Find failed:
java.sql.SQLException: ERROR: operator does not exist: cidr = text
So how should I do?
Thanks in advance.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [GENERAL] JDBC +CIDR (fwd)
2004-10-21 18:27 [GENERAL] JDBC +CIDR (fwd) Kris Jurka <books@ejurka.com>
@ 2004-10-21 20:45 ` Oliver Jowett <oliver@opencloud.com>
2004-10-21 22:42 ` Re: [GENERAL] JDBC +CIDR (fwd) Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Jowett @ 2004-10-21 20:45 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
Kris Jurka wrote:
> What kind of solution can we offer for this problem? Do we really need to
> make PGobject extensions for every type? Do we really want to force
> people to have to create these for all user defined types?
Well, you don't have to create a subclass, I think, if you don't mind
doing the parsing in the application:
PGobject dummy = new PGobject();
dummy.setType("cidr");
dummy.setValue("192.168.0.0/24");
statement.setObject(1, dummy, Types.OTHER);
Alternatively, does setString() + "?::cidr" work?
-O
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [GENERAL] JDBC +CIDR (fwd)
2004-10-21 18:27 [GENERAL] JDBC +CIDR (fwd) Kris Jurka <books@ejurka.com>
2004-10-21 20:45 ` Re: [GENERAL] JDBC +CIDR (fwd) Oliver Jowett <oliver@opencloud.com>
@ 2004-10-21 22:42 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 3+ messages in thread
From: Kris Jurka @ 2004-10-21 22:42 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc
On Fri, 22 Oct 2004, Oliver Jowett wrote:
> Kris Jurka wrote:
> > What kind of solution can we offer for this problem? Do we really need to
> > make PGobject extensions for every type? Do we really want to force
> > people to have to create these for all user defined types?
>
> Well, you don't have to create a subclass, I think, if you don't mind
> doing the parsing in the application:
Right, for some reason I thought PGobject was abstract. It's still not
great to force them to include postgresql specific code in their app, but
I don't see a way around it without abandoning the goal of removing the
use oid zero.
> Alternatively, does setString() + "?::cidr" work?
In this case yes, but not in general. The driver types it as text so this
really comes out as ?::text::cidr which is different from unknown -> cidr.
In this case an explicit cast is available, but this won't be true (by
default) of other types. Consider:
jurka=# select '(1,2),(3,4)'::text::box;
ERROR: cannot cast type text to box
Kris Jurka
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-10-21 22:42 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 18:27 [GENERAL] JDBC +CIDR (fwd) Kris Jurka <books@ejurka.com>
2004-10-21 20:45 ` Oliver Jowett <oliver@opencloud.com>
2004-10-21 22:42 ` Kris Jurka <books@ejurka.com>
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