Skip site navigation (1) Skip section navigation (2)

Socket close exception

From: Hernan Danielan <hernandanielan(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Socket close exception
Date: 2010-05-14 15:09:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Hello! I am using postgress 8.4. I am trying to save to my DB a Large Binary
Object, let's say 1.4MB. I read that LargeObjectAPI should be used.
I have a problem that sometimes i can store the file and some others i get
an exception of

>>org.postgresql.util.PSQLException: An I/O error occured while sending to
the backend.
>> Socket closed

I try to create a connection for each object but the errors perssist with
big files. For smaller files like 13KB this example works great. Does
anybody have this problem??? I debug the applcation and I am getting the
socket close exception during obj.write (....) here is a bit of the code

// Get the Large Object Manager to perform operations with
LargeObjectManager lobj =

// Create a new large object
int oid = lobj.create(LargeObjectManager.READ | LargeObjectManager.WRITE);

// Open the large object for writing
LargeObject obj =, LargeObjectManager.WRITE);
byte []data = cont.getData();

PreparedStatement statement = mDbConnector.prepareStatement("INSERT INTO
publicitiescontent (IdPublicities,MimeType,FileName,Title,Data) VALUES
statement.setBigDecimal(1, new BigDecimal(publicityId));
statement.setString(2, cont.getMimeType());
statement.setString(3, cont.getFileName());
statement.setString(4, cont.getNombre());
statement.setInt(5, oid);

Thanks in advance,


pgsql-jdbc by date

Next:From: Maciek SakrejdaDate: 2010-05-14 15:57:23
Subject: Re: Socket close exception
Previous:From: Rob SargentDate: 2010-05-13 15:18:03
Subject: Re: Invalid message format Exception

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group