largeobjects deadlock ?
От | andy petrella |
---|---|
Тема | largeobjects deadlock ? |
Дата | |
Msg-id | 7159e12c0510251649r48a52bady@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: largeobjects deadlock ?
|
Список | pgsql-jdbc |
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
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
В списке pgsql-jdbc по дате отправления: