pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedLargeObject API
4+ messages / 3 participants
[nested] [flat]
* LargeObject API
@ 2007-08-02 07:44 Dennis Thrysøe <dth@conscius.com>
0 siblings, 2 replies; 4+ messages in thread
From: Dennis Thrysøe @ 2007-08-02 07:44 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
Is there any way to use the proprietary LargeObject API, without
actually having a reference to the postgresql Drivers's Connection object?
I need to store (potentially) large chunks of data, so as I read the
documentation I need to use the oid type for performance reasons.
However, if the application is executing within a j2ee server with
connection pooling, the given Connection instance is just a proxy for
the actual one.
Otherwise I could possibly use PreparedStatement.setBlob(), but how
could I create a Blob instance?
I'm not on the mailing list (yet).
-dennis
---------------------------------------------------------------------------
The information in this email is confidential and may be legally protected.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: LargeObject API
@ 2007-08-02 14:30 Xavier Poinsard <xpoinsard@free.fr>
parent: Dennis Thrysøe <dth@conscius.com>
1 sibling, 0 replies; 4+ messages in thread
From: Xavier Poinsard @ 2007-08-02 14:30 UTC (permalink / raw)
To: Dennis Thrysøe <dth@conscius.com>; +Cc: pgsql-jdbc
Hi,
You have to chose between database portability and better performance.
Personally I am using a BYTEA field and setBytes : this allows me to
have portable code across databases and decent performance.
Regards.
Dennis Thrysøe a écrit :
> Hello,
>
> Is there any way to use the proprietary LargeObject API, without
> actually having a reference to the postgresql Drivers's Connection object?
>
> I need to store (potentially) large chunks of data, so as I read the
> documentation I need to use the oid type for performance reasons.
>
> However, if the application is executing within a j2ee server with
> connection pooling, the given Connection instance is just a proxy for
> the actual one.
>
> Otherwise I could possibly use PreparedStatement.setBlob(), but how
> could I create a Blob instance?
>
> I'm not on the mailing list (yet).
>
> -dennis
> ---------------------------------------------------------------------------
> The information in this email is confidential and may be legally protected.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: LargeObject API
@ 2007-08-02 17:09 Kris Jurka <books@ejurka.com>
parent: Dennis Thrysøe <dth@conscius.com>
1 sibling, 1 reply; 4+ messages in thread
From: Kris Jurka @ 2007-08-02 17:09 UTC (permalink / raw)
To: Dennis Thrysøe <dth@conscius.com>; +Cc: pgsql-jdbc
On Thu, 2 Aug 2007, Dennis Thrysøe wrote:
> Is there any way to use the proprietary LargeObject API, without actually
> having a reference to the postgresql Drivers's Connection object?
Often connection wrappers provide a means to access the underlying
Connection. You don't say what you're using so you'll have to consult
those docs yourself.
> Otherwise I could possibly use PreparedStatement.setBlob(), but how could I
> create a Blob instance?
>
JDBC4 provides a means for creating Blobs, but we haven't implemented that
yet, so the easiest way is to create a Blob is to get it from the
database:
stmt.execute("CREATE TABLE t (a int, b oid)");
stmt.execute("INSERT INTO t VALUES (1, lo_creat(-1))");
ResultSet rs = stmt.executeQuery("SELECT b FROM t WHERE a = 1");
rs.next();
Blob b = rs.getBlob(1);
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: LargeObject API
@ 2007-08-03 06:54 Dennis Thrysøe <dth@conscius.com>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 4+ messages in thread
From: Dennis Thrysøe @ 2007-08-03 06:54 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
Kris Jurka wrote:
> On Thu, 2 Aug 2007, Dennis Thrysøe wrote:
>
>> Is there any way to use the proprietary LargeObject API, without
>> actually having a reference to the postgresql Drivers's Connection
>> object?
>
> Often connection wrappers provide a means to access the underlying
> Connection. You don't say what you're using so you'll have to consult
> those docs yourself.
My goal is to support any j2ee server, so I cannot assume much about any
proxy/pooling mechanism.
> stmt.execute("CREATE TABLE t (a int, b oid)");
> stmt.execute("INSERT INTO t VALUES (1, lo_creat(-1))");
> ResultSet rs = stmt.executeQuery("SELECT b FROM t WHERE a = 1");
> rs.next();
> Blob b = rs.getBlob(1);
Thanks. That looks like a good solution.
-dennis
---------------------------------------------------------------------------
The information in this email is confidential and may be legally protected.
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2007-08-03 06:54 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-08-02 07:44 LargeObject API Dennis Thrysøe <dth@conscius.com>
2007-08-02 14:30 ` Xavier Poinsard <xpoinsard@free.fr>
2007-08-02 17:09 ` Kris Jurka <books@ejurka.com>
2007-08-03 06:54 ` Dennis Thrysøe <dth@conscius.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