Jump to content
We've recently updated our Privacy Statement, available here ×

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


kkelleher

Recommended Posts

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?


Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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>datapostgresql.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.


 


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...