[Fwd: [Fwd: Re: solved: fastpath error?]]

Поиск
Список
Период
Сортировка
От Barry Lind
Тема [Fwd: [Fwd: Re: solved: fastpath error?]]
Дата
Msg-id 3D0DB540.4040501@xythos.com
обсуждение исходный текст
Список pgsql-jdbc
   Micheal,

Are you still having problems here?  If so could you explain what
problems you still have?  It wasn't clear when I reread this message
what you had solved and what was still a problem.

thanks,
--Barry

-------- Original Message --------

Subject: Re: [JDBC] solved: fastpath error?
Date: Wed, 05 Jun 2002 19:01:18 +0200
From: "M. Dietrich"
Reply-To: mdt@emdete.de
Organization: emdete
To: Barry Lind
References: <20020506134350.GE3762@emdete.de> <3CD6AD9D.7000402@xythos.com>

On Mon, May 06, 2002 at 09:21:49AM -0700, Barry Lind wrote:
  > >i get still those fastpath errors with the jdbc drivers. i tested the
  > >driver installed with debian, the stable and the development driver
  > >from jdbc.postgresql.org. has anybody else the same problem?
  > >
  > >i use blobs alot. using blobs with pg-sql's jdbc does not work
  > >strait-forward in a jdbc-manner like this:
  > >
  > >    statement.setBinaryStream(4, in, size);
  > >
  > >even this does not work:
  > >
  > >    byte buffer[] = new byte[(int)size];
  > >        in.read(buffer);
  > >        statement.setBytes(4, buffer);
  > >
  > >
  > >so this one is what i found out works best for me:
  > >
  > >    org.postgresql.largeobject.LargeObjectManager lom =
  > >    ((org.postgresql.Connection)getConnection()).getLargeObjectAPI();
  > >    int loid = lom.create();
  > >    org.postgresql.largeobject.LargeObject blob = lom.open(loid);
  > >    int s;
  > >    byte buf[] = new byte[2048];
  > >        while ((s = in.read(buf, 0, buf.length)) > 0)
  > >            blob.write(buf, 0, s);
  > >        blob.close();
  > >    java.sql.Blob b = new
  > >
org.postgresql.largeobject.PGblob((org.postgresql.Connection)getConnection(),

loid);
  > >        statement.setBlob(4, b);
  > >
  > >but using this i get the fast-path error. using the other versions
  > >results in a errormessage containing all the binary data.
  > What version of postgres and what version of the jdbc drivers are you
  > using?
  >
  > Also, more info would be helpful.  When you say 'doesn't work' that
  > doesn't give us a lot to go on.  Error messages and any output you
  > are getting would help a lot.

i use the stable version 7.2 and the development version i downloaded
from the server:

-rw-r--r--    1 mdt      mdt         96179 16. Apr 23:55 devpgjdbc2.jar


in my application png-images will be filled into a database. this is
the create-statement i use for the table:

CREATE TABLE MD_DOCUMENT ( MD_DESCRIPTION CHARACTER VARYING(300),
MD_ENTRYDATE TIMESTAMP DEFAULT NOW(),  MD_MIMETYPE CHARACTER
VARYING(300),  MD_DATA OID,  MD_OID BIGINT NOT NULL)
CREATE UNIQUE INDEX MD_IDOCUMENT ON MD_DOCUMENT(MD_OID)


using the first methode, i get the error (jdbc-log enabled, btw why
doesn't the log provide the version?):


DriverManager.getConnection("jdbc:postgresql://localhost:5432/sally")
      trying
driver[className=org.postgresql.Driver,org.postgresql.Driver@63bfb6]
postgresql: PASSWORD
getConnection returning
driver[className=org.postgresql.Driver,org.postgresql.Driver@63bfb6]
Traceback (innermost last):

java.sql.SQLException: ERROR:  oidin: error in
"\211PNG\015\012\032\012\000\000\000\015IHDR\000\000\003 \000\000\000\

using the secound methode i get more or less the same error:

DriverManager.getConnection("jdbc:postgresql://localhost:5432/sally")
      trying
driver[className=org.postgresql.Driver,org.postgresql.Driver@4cc621]
postgresql: PASSWORD
getConnection returning
driver[className=org.postgresql.Driver,org.postgresql.Driver@4cc621]
Traceback (innermost last):

java.sql.SQLException: ERROR:  oidin: error in
"\211PNG\015\012\032\012\000\000\000\015IHDR\000\000\003
\000\000\000\235\010\006\000\000\001;\313,\310\000\000
\000IDATx\332\354]wx\024\305\

both methode work fine with other jdbc drivers. finally i use the
postgres proprietary methode with the large object manager. this works
fine for a while but gets the error:

NOTICE:  current transaction is aborted, queries ignored until end of
transaction block

SQLWarning: reason(NOTICE:  current transaction is aborted, queries
ignored until end of transaction block
)
Traceback (innermost last):

FastPath-Aufruf ergab »ERROR:  current transaction is aborted, queries
ignored until end of transaction block
«.
          at org.postgresql.fastpath.Fastpath.fastpath(Unknown Source)
          at org.postgresql.fastpath.Fastpath.fastpath(Unknown Source)
          at org.postgresql.fastpath.Fastpath.getInteger(Unknown Source)
          at org.postgresql.largeobject.LargeObjectManager.create(Unknown
Source)
          at de.emdete.sallys.Db.newDocument(Db.java:326)

org.postgresql.util.PSQLException: FastPath-Aufruf ergab »ERROR:
current transaction is aborted, queries ignored until end of transaction
block
«.

  > This might be useful: http://www.j-elite.com/pgprimer , then go to the
  > BLOB section and see if its helps... if not - let me know what would be
  > useful additions in there and I'll add them ;)

okay, i read this. it says that since 7.2 blob and bytea are different
in the way the data is stored. with a table created with type bytea the
jdbc-konform methode work fine. also the FastPath-error didn't show up.

the documentation at http://www.j-elite.com/pgprimer sayes that
setBytes/setBinaryStream can only be used with bytea while setBlob has
to be used with oid. so that ist the cause for my first error. but the
second is still not solved as far i understand.

the samplecode provided uses postgresql methodes to create a blob as i
did. what would be the jdbc-konform way to create a Blob-object?

best regards

    michael








В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: JBuilder 6 & JDBC
Следующее
От: Vernon Wu
Дата:
Сообщение: HELP PLEASE ~ Re: How to retrieve an array of string using JDBC?