pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: andy petrella <andy.petrella@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: largeobjects deadlock ?
Date: Wed, 26 Oct 2005 01:49:41 +0200
Message-ID: <7159e12c0510251649r48a52bady@mail.gmail.com> (raw)

HI all,

I have somme problem with largeobjects setting in a preparedstatement, here
is the code with the problem in comment // :

[...]
 db.setAutoCommit(false);
[...]
 LargeObjectManager lobj = pgdb.getLargeObjectAPI(); //pgdb is a
PGConnection
 int loid = lobj.create();
 System.out.println("loid : " + loid); //this give 359648
 LargeObject image = lobj.open(loid);
 int s, count = 0;
 byte buf[] = new byte[2048];
 while ((s = affiche.read(buf, 0, buf.length)) > 0){ //affiche is an
InputStream
 count += s;
 image.write(buf, 0, s);
 }
 BlobInputStream b = new BlobInputStream(image);
 addDVD.setBinaryStream(4, b, count); //addDVD is an PreparedStatement
 //addDVD.setNull(4, java.sql.Types.BINARY); // --> all work well if I
decomment this and comment the preceding
 image.close();
 affiche.close();
[...]
System.out.println("addDVD : " + addDVD.toString()); //<stream of 6503
bytes> for the fourth prm (bytea)

 int update = addDVD.executeUpdate(); // -->deadlocking here !!!
 System.out.println("update = " + update); //never pass here
 db.setAutoCommit(true);
[...]

Am I setting the bytea in the rigth manner ? Else, how may I do that , where
are my mistakes ?

Thx u all.

andy

view thread (2+ messages)  latest in thread

Message-ID: <7159e12c0510251649r48a52bady@mail.gmail.com>
Permalink:  ../7159e12c0510251649r48a52bady@mail.gmail.com/
Also on:    postgresql.org/message-id/7159e12c0510251649r48a52bady@mail.gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: andy.petrella@gmail.com
  Subject: Re: largeobjects deadlock ?
  In-Reply-To: <7159e12c0510251649r48a52bady@mail.gmail.com>
  References: <7159e12c0510251649r48a52bady@mail.gmail.com>

* 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