From: Steffen Zimmert <szimmert@crcg.edu>
To: Peter Mount <petermount@it.maidstone.gov.uk>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] JDBC:Using Large Objects
Date: Tue, 22 Jun 1999 14:51:08 -0700
Message-ID: <3770054C.CCCC323B@crcg.edu> (raw)
References: <1B3D5E532D18D311861A00600865478C9FCD@exchange1.nt.maidstone.gov.uk>
Hi,
> The large object code has been working for some time now, however not
> all of the stream methods work fully.
>
> The best thing is to look at the blobtest and ImageViewer examples in
> the src/interfaces/jdbc/example directory, as they show what methods are
> currently supported.
I looked at the suggested source files and also compiled them. However,
I was not able to run neither Bobtest nor ImageViewer because the same
exception messages occured as in my own application. In addition, I
wrote also a little application based on the source of blobtest and the
exception occurs whenever I try to save a LargeObject. Here's the
source:
// Load the driver
Class.forName("postgresql.Driver");
// Connect to database
System.out.println("Connecting to Database URL = " + url);
db = DriverManager.getConnection(url, usr, pwd);
System.out.println("Connected...Now creating a statement");
stat = db.createStatement();
// Also, get the LargeObjectManager for this connection
System.out.println("Gaining access to LargeObjectApi.");
lom = ((postgresql.Connection)db).getLargeObjectAPI();
// Now create the large object
System.out.println("creating blob");
int oid = lom.create();
System.out.println("Opening "+oid);
LargeObject blob = lom.open(oid);
// Create a new TestObject
System.out.println("Creating a new TestObject...");
TestObject tObject = new TestObject(1);
// Convert TestObject to Byte array
System.out.println("Converting object to byte array...");
byte[] objBytes = objectToBytes(tObject);
System.out.println("Size of byte array: " + objBytes.length);
// Writing byte array to blob
System.out.println("Writing byte array to blob...");
blob.write(objBytes,0,objBytes.length);
^^^^
The following exception occurs here!
Exception caught.
java.sql.SQLException: IOError while reading from backend:
java.io.IOException: The backend has broken the connection. Possibly the
action you have attempted has caused it to close.
java.sql.SQLException: IOError while reading from backend:
java.io.IOException: The backend has broken the connection. Possibly the
action you have attempted has caused it to close.
at postgresql.PG_Stream.ReceiveChar(PG_Stream.java:183)
at postgresql.fastpath.Fastpath.fastpath(Compiled Code)
at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:185)
at
postgresql.largeobject.LargeObject.write(LargeObject.java:147)
at
postgresql.PreparedStatement.setBytes(PreparedStatement.java:295)
at basic.<init>(basic.java:45)
at basic.main(basic.java:107)
Are there perhaps any parameters you have to specify during the
installation process of the database to explicitly allow the storage of
large objects?
Any help is welcome because I really don't know what to do now! :-((
--
Best Regards,
Steffen Zimmert
Steffen Zimmert
Fraunhofer Center for Research in Computer Graphics
Providence, Rhode Island, USA
email: szimmert@crcg.edu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: szimmert@crcg.edu, petermount@it.maidstone.gov.uk
Subject: Re: [INTERFACES] JDBC:Using Large Objects
In-Reply-To: <3770054C.CCCC323B@crcg.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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