pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Error in connector or driver with big bytea
3+ messages / 3 participants
[nested] [flat]

* Error in connector or driver with big bytea
@ 2010-05-22 19:03 Hernan Danielan <hernandanielan@gmail.com>
  2010-05-23 05:13 ` Re: Error in connector or driver with big bytea Craig Ringer <craig@postnewspapers.com.au>
  2010-05-23 14:42 ` Re: Error in connector or driver with big bytea Lew <noone@lewscanon.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Hernan Danielan @ 2010-05-22 19:03 UTC (permalink / raw)
  To: pgsql-jdbc

Hello! I have a problem for several days now. I am trying to insert a record
with a file of 1.4MB in a postgre database with a JDBC connector. When i
insert files around 100KB it works great. However it does not work with
greater ones. I use both method bytea and oid but both of them give me the
same error in the database log:


2010-05-22 15:30:44 ART LOCATION:  exec_bind_message, postgres.c:1769
2010-05-22 15:30:44 ART LOG:  08006: could not send data to client:
Connection reset by peer
2010-05-22 15:30:44 ART LOCATION:  internal_flush, pqcomm.c:1108
.....
2010-05-22 15:30:45 ART LOCATION:  exec_execute_message, postgres.c:1988
2010-05-22 15:30:46 ART LOG:  08006: could not send data to client: Broken
pipe
2010-05-22 15:30:46 ART LOCATION:  internal_flush, pqcomm.c:1108
....
2010-05-22 15:35:10 ART LOG:  00000: aborting any active transactions


With the following code

mDbConnector.setAutoCommit(false);
// Get the Large Object Manager to perform operations with
LargeObjectManager lobj = ((org.postgresql
.PGConnection)mDbConnector).getLargeObjectAPI();

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

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

obj.write(data,0,data.length);
obj.close();
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);
statement.execute();
statement.close();
mDbConnector.commit();


Any ideas or bug detected in the connector with this problem?

Thanks in advance,
Hernan

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Error in connector or driver with big bytea
  2010-05-22 19:03 Error in connector or driver with big bytea Hernan Danielan <hernandanielan@gmail.com>
@ 2010-05-23 05:13 ` Craig Ringer <craig@postnewspapers.com.au>
  1 sibling, 0 replies; 3+ messages in thread

From: Craig Ringer @ 2010-05-23 05:13 UTC (permalink / raw)
  To: Hernan Danielan <hernandanielan@gmail.com>; +Cc: pgsql-jdbc

On 23/05/10 03:03, Hernan Danielan wrote:
> Hello! I have a problem for several days now. I am trying to insert a
> record with a file of 1.4MB in a postgre database with a JDBC connector.
> When i insert files around 100KB it works great. However it does not
> work with greater ones. I use both method bytea and oid but both of them
> give me the same error in the database log:
>
>
> 2010-05-22 15:30:44 ART LOCATION:  exec_bind_message, postgres.c:1769
> 2010-05-22 15:30:44 ART LOG:  08006: could not send data to client:
> Connection reset by peer
> 2010-05-22 15:30:44 ART LOCATION:  internal_flush, pqcomm.c:1108
> .....
> 2010-05-22 15:30:45 ART LOCATION:  exec_execute_message, postgres.c:1988
> 2010-05-22 15:30:46 ART LOG:  08006: could not send data to client:
> Broken pipe
> 2010-05-22 15:30:46 ART LOCATION:  internal_flush, pqcomm.c:1108
> ....
> 2010-05-22 15:35:10 ART LOG:  00000: aborting any active transactions
>
>
> With the following code

Can you supply a *fully* stand-alone test case? And make sure it still 
encounters the problem on your server?

Also, in your test case, when the JDBC driver throws, don't catch the 
exception. Let it propagate out to terminate the program so that the JRE 
prints detailed exception info on all nested exceptions.

--
Craig Ringer



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Error in connector or driver with big bytea
  2010-05-22 19:03 Error in connector or driver with big bytea Hernan Danielan <hernandanielan@gmail.com>
@ 2010-05-23 14:42 ` Lew <noone@lewscanon.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Lew @ 2010-05-23 14:42 UTC (permalink / raw)
  To: pgsql-jdbc

On 05/22/2010 03:03 PM, Hernan Danielan wrote:
> Hello! I have a problem for several days now. I am trying to insert a
> record with a file of 1.4MB in a postgre database with a JDBC connector.

A "Postgres" database.

-- 
Lew



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-05-23 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-22 19:03 Error in connector or driver with big bytea Hernan Danielan <hernandanielan@gmail.com>
2010-05-23 05:13 ` Craig Ringer <craig@postnewspapers.com.au>
2010-05-23 14:42 ` Lew <noone@lewscanon.com>

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