RE: JDBC driver writes binary data ONLY as Large Obj ect

From: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
To: "'Bill'" <bouma(at)cplane(dot)com>, Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: RE: JDBC driver writes binary data ONLY as Large Obj ect
Date: 2000-08-04 06:42:52
Message-ID: 1B3D5E532D18D311861A00600865478CF1B1CD@exchange1.nt.maidstone.gov.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

It is inefficient mainly because each LO is (under the current backend
implementation) stored as a table/index pair, so if you have loads of LO's
under 16K (IIRC it's 1 page for the table, 1 for the index), then you would
be wasting a lot of disk space.

The new Toast stuff may become useful for this as an alternative.

Now as to your error, the parse error is being thrown by the backend (the
driver currently does no parsing other than replacing ?'s from the
PreparedStatement), so you could try turning on debugging [
DriveManager.setLogStream(System.out); ] and see what the exact query being
sent is.

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council

-----Original Message-----
From: Bill [mailto:bouma(at)cplane(dot)com]
Sent: Thursday, August 03, 2000 8:46 PM
To: Peter Mount
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] JDBC driver writes binary data ONLY as Large
Object

Peter Mount wrote:

> Hmmm, I see your point. There must be some way of encoding the string so
> that the data is stored correctly. I know certain control characters can
be
> stored (cr/lf's etc) as I have a PHP script that does it here.
>
> Is it the new String(bytes[]) bit that barfs, or is it that the data is
> mungled when it's re-read from the table?

-------------------------------------------
java.sql.SQLException: ERROR: parser: parse error at or near ""

at org.postgresql.Connection.ExecSQL(Connection.java, Compiled Code)
at org.postgresql.jdbc2.Statement.execute(Statement.java, Compiled
Code)

at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:73)
at
org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:
126)

-------------------------------------------

Perhaps we can look at the ResultSet.getBytes() and just do the inverse of
that? Though I haven't tested if getBytes() is doing the right thing yet,
either.
In the end I need to be able to store/retrieve the data through both JDBC
and
ODBC interface. This is working now if I store all binary data as Large
Objects. But most of my blobs of binary are only 200-2000 bytes long. I
assume it is much less efficient to store such small blobs as LOs? That
is,
assuming the driver code is written well. So that may not be true with the
current JDBC driver given that it would first have to convert the binary
blob into a String. 8^(

Bill

Browse pgsql-interfaces by date

  From Date Subject
Next Message Antonio Navarro Navarro 2000-08-04 07:01:47 Re: Python + PostgreSQL
Previous Message Craig Orsinger 2000-08-03 23:49:49 RE: ODBC driver on NT client