JRS gives StreamCorruptedException when using Postgres 8.x driver with Postgres 9.x

0

My JRS repository is hosted by Postgres 9.3, but I need to use an 8.x driver. It’s not working. The application doesn’t load the license properly, and I see some problems in the log like:

java.io.StreamCorruptedException: invalid stream header: XXXXXXXX

 

How can I work around this issue?

kkelleher's picture
281
Joined: Jul 19 2006 - 4:59am
Last seen: 2 months 1 week ago

1 Answer:

0

Apparently, 9.x versions of Postgres have a new binary encoding algorithm for LOB fields. This changed a setting’s default value in 9.x (bytea_output); the 8.x driver doesn’t recognize the new encoding, and fails to read the value.

Two workarounds have been suggested:

  • Option 1: Use the Postrgres 9.x JDBC driver instead of the 8.x version.
  • Option 2: Reconfigure postgres instance to use 8.x default value.

For Option 2:

1- Edit the <postgres>\data\postgresql.conf file.

2 - Locate this line:

    bytea_output = ' hex'          # hex, escape

3 - Change : ' hex' to 'escape'. For example:

    bytea_output = 'escape'          # hex, escape

You need to make this change BEFORE any data is written to the database.

Note that this configuration affects everything in this Postgres instance. If other apps have databases in this Postgres instance, they will also need to be able to handle the ‘escape’ setting for the bytea_output option.

 

kkelleher's picture
281
Joined: Jul 19 2006 - 4:59am
Last seen: 2 months 1 week ago
Feedback