Team Elements

Status: Caution PostgreSQL Open Source Initiative (OSI) Java
PUBLIC PROFILE

Back to topics

Issues and Open Discussion

UNICODE vs. UTF8 in Postgres

You need to be logged in to post messages

UNICODE vs. UTF8 in Postgres

9/19/2006 9:13 PM EDT

I'm getting the following error in my catalina log, while trying to set up the app for the first time:

DatabaseUtils-> ERROR(1), line: 2 message: The server's client_encoding parameter was changed to UTF8. The JDBC driver requires client_encoding to be UNICODE for correct operation.

I've checked the available encodings on the same system, and a few others and "UNICODE" is not an available encoding although "UTF8" is. Everything I've read in the Postgres docs implies that UTF8 /is/ Unicode, though I admit I'm not familiar enough with unicode to know for sure...

I've tested a couple different OS+Postgres combinations and I get the same error using either:

Team Elements 3.1.1
Debian Testing + Postgres 8.1.3
Gentoo 2006.1 + Postgres 8.1.4

Is this perhaps a simple string comparison where it is expecting "UNICODE" but getting "UTF8" or is there something else wrong?

-Mike

1. 9/20/2006 9:11 AM EDT (edited)
Default user photo

By Matt Rajkowski

Concursive Corporation
Product Design

airplane-icon-100x100.png

It turns out that the latest PostgreSQL JDBC driver was included and we recently found out that the driver now quits when the encoding doesn't match in the sql commands issued during the database installation. The driver did not previously do this.

The quick fix is to find the postgresql.sql file and change the first line with a text editor before running the database part of the setup.

After you place the .war in Tomcat's webapp directory and Tomcat starts up, it will explode out the .war contents into a directory.

Find the file:

team/WEB-INF/setup/postgresql.sql

and change:

SET client_encoding = 'UTF8';

to

SET client_encoding = 'UNICODE';

BTW, please let us know if this fixes it and we can issue a quick update. If that doesn't work you might want to remove the line completely.

We plan to remove all the lines before the first CREATE TABLE statement, and the lines at the bottom of the file that issue REVOKE and GRANT commands as these are now unnecessary.

Thanks,
Matt

2. 9/20/2006 3:55 PM EDT

Thanks! That worked just fine.

One other minor thing in the sql file. These lines might be a bit off:

7: COMMENT ON SCHEMA public IS 'Standard public schema';
3255: REVOKE ALL ON SCHEMA public FROM PUBLIC;
3256: REVOKE ALL ON SCHEMA public FROM postgres;
3257: GRANT ALL ON SCHEMA public TO postgres;
3258: GRANT ALL ON SCHEMA public TO PUBLIC;

Since they require a lot more privilege than is required for a normal database user.

Keep up the good work.

-Mike

2 results found