Обсуждение: Blob's that worked in 7.1 fail in 7.2.1

Поиск
Список
Период
Сортировка

Blob's that worked in 7.1 fail in 7.2.1

От
Michael Andreasen
Дата:
I have just upgrading my database to 7.2.1 (I was on 7.1.3)

There are some little funnies between the two versions, mostly things
that have been tightened up in 7.2.1.

However, I have found the this code that used to work now fails. It is
code for writting a blob (image) back into the database.

                    File file = new File(imageFileName);
                    FileInputStream fis = new FileInputStream(file);
                    int length = (int)file.length();
                    pStmt.setBinaryStream(1, fis, length);
                    pStmt.setInt(2, currentEmployee);
                    int upd = pStmt.executeUpdate();

It now fails with this....

java.sql.SQLException: ERROR:  oidin: error in "~DGR:LOGO,09180,054,000000000000000.........

can't parse "~DGR:LOGO,09180,054,000000000000000........ etc, etc ....
    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:94)
    at org.postgresql.Connection.ExecSQL(Connection.java:398)
    at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
    at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:73)
    at org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:113)
    at com.dunlops.warehouse.checking.SetCustomerLogo.saveLogo(SetCustomerLogo.java:124)



What's wrong?






Re: Blob's that worked in 7.1 fail in 7.2.1

От
Barry Lind
Дата:
Michael,

Have you read the documentation on the postgres jdbc driver included in
the 7.2 docs?  It explains the changed behavior and how to revert to the
old behavior if you need to.

thanks,
--Barry

Michael Andreasen wrote:
> I have just upgrading my database to 7.2.1 (I was on 7.1.3)
>
> There are some little funnies between the two versions, mostly things
> that have been tightened up in 7.2.1.
>
> However, I have found the this code that used to work now fails. It is
> code for writting a blob (image) back into the database.
>
>                    File file = new File(imageFileName);
>                    FileInputStream fis = new FileInputStream(file);
>                    int length = (int)file.length();
>                    pStmt.setBinaryStream(1, fis, length);
>                    pStmt.setInt(2, currentEmployee);
>                    int upd = pStmt.executeUpdate();
>
> It now fails with this....
>
> java.sql.SQLException: ERROR:  oidin: error in
> "~DGR:LOGO,09180,054,000000000000000.........
>
> can't parse "~DGR:LOGO,09180,054,000000000000000........ etc, etc ....
>     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:94)
>     at org.postgresql.Connection.ExecSQL(Connection.java:398)
>     at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
>     at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:73)
>     at
> org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:113)
>
>     at
> com.dunlops.warehouse.checking.SetCustomerLogo.saveLogo(SetCustomerLogo.java:124)
>
>
>
>
> What's wrong?
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>