X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D2A73DAE9C for ; Tue, 25 Oct 2005 20:49:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74113-09 for ; Tue, 25 Oct 2005 23:49:36 +0000 (GMT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.202]) by svr1.postgresql.org (Postfix) with ESMTP id BDD9CDAEB1 for ; Tue, 25 Oct 2005 20:49:37 -0300 (ADT) Received: by xproxy.gmail.com with SMTP id s14so66386wxc for ; Tue, 25 Oct 2005 16:49:41 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=GH9BYLXhVIg9koTUDeFSwPFu5ZtBQRIPZGiFGcqEnmJOy5fO3HPUt2bMC0/6FG0k2MNl2znZBZUFvy/ZUtk2rkMLQ6c+b77Lp6n8lIlzs+kRSIF3oqmPHupPHciRY5AUR0QOMOngFc/LlcaVSknSK44IWpp9vOyk/Wtd32bAFho= Received: by 10.65.52.20 with SMTP id e20mr181518qbk; Tue, 25 Oct 2005 16:49:41 -0700 (PDT) Received: by 10.65.204.17 with HTTP; Tue, 25 Oct 2005 16:49:41 -0700 (PDT) Message-ID: <7159e12c0510251649r48a52bady@mail.gmail.com> Date: Wed, 26 Oct 2005 01:49:41 +0200 From: andy petrella To: pgsql-jdbc@postgresql.org Subject: largeobjects deadlock ? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10913_20625325.1130284181382" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.025 required=5 tests=[HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200510/133 X-Sequence-Number: 14064 ------=_Part_10913_20625325.1130284181382 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 =3D pgdb.getLargeObjectAPI(); //pgdb is a PGConnection int loid =3D lobj.create(); System.out.println("loid : " + loid); //this give 359648 LargeObject image =3D lobj.open(loid); int s, count =3D 0; byte buf[] =3D new byte[2048]; while ((s =3D affiche.read(buf, 0, buf.length)) > 0){ //affiche is an InputStream count +=3D s; image.write(buf, 0, s); } BlobInputStream b =3D 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()); // for the fourth prm (bytea) int update =3D addDVD.executeUpdate(); // -->deadlocking here !!! System.out.println("update =3D " + update); //never pass here db.setAutoCommit(true); [...] Am I setting the bytea in the rigth manner ? Else, how may I do that , wher= e are my mistakes ? Thx u all. andy ------=_Part_10913_20625325.1130284181382 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline HI all,

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

[...]
      &nb= sp;     db.setAutoCommit(false);
[...]     &nbs= p;    
      &nb= sp;     LargeObjectManager lobj =3D pgdb.getLargeObject= API(); //pgdb is a PGConnection
      &nb= sp;     int loid =3D lobj.create();
      &nb= sp;     System.out.println("loid : " + loid);= //this give 359648
      &nb= sp;     LargeObject image =3D lobj.open(loid); <= br style=3D"font-style: italic;">       &nb= sp;     int s, count =3D 0;
      &nb= sp;     byte buf[] =3D new byte[2048];
      &nb= sp;     while ((s =3D affiche.read(buf, 0, buf.length))= > 0){ //affiche is an InputStream
      &nb= sp;         count +=3D s;       &nb= sp;         image.write(buf, 0, s);=
      &nb= sp;     }
      &nb= sp;     BlobInputStream b =3D new BlobInputStream(image= );
      &nb= sp;     addDVD.setBinaryStream(4, b, count); //addDVD is an PreparedStatement
      &nb= sp;     //addDVD.setNull(4, java.sql.Types.BINARY); // = --> all wo= rk well if I decomment this and comment the preceding
      &nb= sp;     image.close();
      &nb= sp;     affiche.close();
[...]
   =          System.out.println("a= ddDVD : " + addDVD.toString()); // <stream of 6503 bytes> for the fourth prm (bytea)
      &nb= sp;    
      &nb= sp;     int update =3D addDVD.executeUpdate(); // -->deadlocking = here !!!
      &nb= sp;     System.out.println("update =3D " + up= date); //never pass here       &nb= sp;     db.setAutoCommit(true);
[...]

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

Thx u all.

andy

------=_Part_10913_20625325.1130284181382--