Thread: RE: using large objects with jdbc
You have to wrap all large object calls within a transaction (this is a restriction of the backend, not JDBC). To enable them, you call the Connection.setAutoCommit method, and set it to false. ie: Connection mycon = ...; mycon.setAutoCommit(false);// large object calls here Peter -- Peter Mount Enterprise Support Officer, Maidstone Borough Council Email: petermount@maidstone.gov.uk WWW: http://www.maidstone.gov.uk All views expressed within this email are not the views of Maidstone Borough Council -----Original Message----- From: Manika dey [mailto:bithi@plasma.ernet.in] Sent: Wednesday, November 01, 2000 10:02 PM To: Peter Mount Cc: postgres-inter Subject: using large objects with jdbc I am using largeobject for storing my datafiles in database postgresql6.3.2 but when I try to retrieve my data from database to a file.i get the following type of error Exception caught. java.sql.SQLException: Fastpath: ERROR: lo_tell: invalid large object descriptor (0) java.sql.SQLException: Fastpath: ERROR: lo_tell: invalid large object descriptor (0) at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:135) at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:181) at postgresql.fastpath.Fastpath.getInteger(Fastpath.java:193) at postgresql.largeobject.LargeObject.tell(LargeObject.java:206) at postgresql.largeobject.LargeObject.size(LargeObject.java:221) at dfile.<init>(dfile.java:86) at dfile.main(dfile.java:128) how can i get rid of the above mentioned errors. manika ------------------------------------------------------------------- From:- | Ms. Manika Dey. |Ph.No:--Engineer-SC (Comp. Tech.) | IPR -- 02712 -69276 I.P.R | EXT 336,315BHAT, GANDHINAGAR | Residence -- 079 - 6619967Gujrat-- 382 428 | FAX --- 69017 ------------------------------------------------------------------
As JDBC doesn't use any local files, I'd say this is caused by make trying to rebuild the driver, and is a local file permissions problem. Check that your user has write access to that part of the source. Peter -- Peter Mount Enterprise Support Officer, Maidstone Borough Council Email: petermount@maidstone.gov.uk WWW: http://www.maidstone.gov.uk All views expressed within this email are not the views of Maidstone Borough Council -----Original Message----- From: Manika dey [mailto:bithi@plasma.ernet.in] Sent: Thursday, November 02, 2000 5:36 PM To: Peter Mount Cc: postgres-inter Subject: RE: [INTERFACES] using large objects with jdbc when i try to use jdbc interface of postgres from my directory it gives me the errors mentioned below , but the example programs in postgres directory compiles and runs prefectly (when login as postgres) error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/large object/LargeObjectManager.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/ Connection.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgre sql/largeobject/LargeObject.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc /postgresql/fastpath/Fastpath.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/ Bpostgresql/ResultSet.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/fastp ath/FastpathArg.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/PG_St ream.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/ Driver.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/util/ UnixCrypt.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/ Statement.class error: Can't write: /users16/home/postgres/postgresql-6.3.2/src/interfaces/jdbc/postgresql/ PreparedStatement.class ------------------------------------------------------------------- From:- | Ms. Manika Dey. |Ph.No:--Engineer-SC (Comp. Tech.) | IPR -- 02712 -69276 I.P.R | EXT 336,315BHAT, GANDHINAGAR | Residence -- 079 - 6619967Gujrat-- 382 428 | FAX --- 69017 ------------------------------------------------------------------
Turn off auto commit using: Connection mycon;mycon.setAutoCommit(false); Peter -- Peter Mount Enterprise Support Officer, Maidstone Borough Council Email: petermount@maidstone.gov.uk WWW: http://www.maidstone.gov.uk All views expressed within this email are not the views of Maidstone Borough Council -----Original Message----- From: Manika dey [mailto:bithi@plasma.ernet.in] Sent: Thursday, November 02, 2000 6:03 PM To: Peter Mount Cc: postgres-inter Subject: RE: [INTERFACES] using large objects with jdbc Hi, in the very prevoius mail i mailed you some error i have rectified it but i am getting the following error now Opening large object 25121 Opening test destination object Copying large object to file Exception caught. java.sql.SQLException: Fastpath: ERROR: lo_tell: invalid large object descriptor (0) java.sql.SQLException: Fastpath: ERROR: lo_tell: invalid large object descriptor (0) at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:135) at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:181) at postgresql.fastpath.Fastpath.getInteger(Fastpath.java:193) at postgresql.largeobject.LargeObject.tell(LargeObject.java:206) at postgresql.largeobject.LargeObject.size(LargeObject.java:221) at dfile.<init>(dfile.java:86) at dfile.main(dfile.java:128) it writes fine to database but while reading it gives the above mentioned error i will be thankful if somebody can help solve this problem .thanks ------------------------------------------------------------------- From:- | Ms. Manika Dey. |Ph.No:--Engineer-SC (Comp. Tech.) | IPR -- 02712 -69276 I.P.R | EXT 336,315BHAT, GANDHINAGAR | Residence -- 079 - 6619967Gujrat-- 382 428 | FAX --- 69017 ------------------------------------------------------------------
i am trying to retrive my data through Web using java servlets but it seems servlet is not able to get the driver as it gives the error : Fastpath: ERROR: lo_tell: invalid large object descriptor (-1) ie. the servlet is not able to get the oid needed to retrieve the data i get this error only when i am using servlet to retrieve the data, i tried by keeping the postgresql.jar in servlet engine's lib directory also. can anyone help to sort out this problem .it's important. i am using JDK2.0 on solaris2.5 platform ------------------------------------------------------------------- From:- | Ms. Manika Dey. |Ph.No:--Engineer-SC (Comp. Tech.) | IPR -- 02712 -69276 I.P.R | EXT 336,315BHAT, GANDHINAGAR | Residence -- 079 - 6619967Gujrat-- 382 428 | FAX --- 69017 ------------------------------------------------------------------