Re: [JDBC] Conversion between UNICODE and LATIN1 is not supported

From: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
To: Nikola Milutinovic <Nikola(dot)Milutinovic(at)ev(dot)co(dot)yu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [JDBC] Conversion between UNICODE and LATIN1 is not supported
Date: 2002-12-19 07:46:35
Message-ID: 200212190846.43267.andreak@officenet.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 19 December 2002 08:37, you wrote:
> Andreas Joseph Krogh wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi all!
> > I get the following error when trying to connect to a pg-7.3 database on
> > Solaris8 with the 7.3 JDBC-driver.
> > Here is my output on the Solaris box:
> > www=> select version();
> > version
> > - -----------------------------------------------------------------------
> > PostgreSQL 7.3 on sparc-sun-solaris2.8, compiled by GCC gcc (GCC) 3.2
> > (1 row)
> >
> > www=> set client_encoding = 'UNICODE';
> > ERROR: Conversion between UNICODE and LATIN1 is not supported
>
> This is not JDBC interface, it is PSQL command line utility!
>
> The message most likely is due to your database being LATIN1 encoded and I
> must agree with PostgreSQL - Unicode cannot be converted to Latin1, not all
> of it.
>
> So, check the database encoding: "psql -l".

I'm sorry if I was unclear, I initially got the error using the JDBC-driver
which issues the commands:
java.sql.ResultSet acRset =
ExecSQL("set client_encoding = 'UNICODE'; show autocommit");

//set encoding to be unicode
encoding = Encoding.getEncoding("UNICODE", null);

if (!acRset.next())
{
throw new PSQLException("postgresql.con.failed", "failed getting
autocommit status");
}

in AbstractJdbc1Connection.openConnection()

I had to recompile the JDBC-drivers with the method changed to
"set client_encoding = 'LATIN1'", as my database is as you guessed created
with "createdb -E LATIN1 dbname"

Then I realised I could reproduse it from the psql cmd-line, and posted the
error I got from there. Sorry for the confusion.

But my question still stands, why does this work on Linux and not Solaris8?
The docs say PostgreSQL can convert to and from LATIN1<->UNICODE as long as
multibyte support is enabled, which it is default in 7.3.

- --
Andreas Joseph Krogh <andreak(at)officenet(dot)no>
The difference between insanity and genius is measured by success
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+AXljUopImDh2gfQRAlnYAJkBD+9kBPH8ME0doqOPctHApgHLowCeKkxK
5m5GngiT8tW7gUAPPTRV9JI=
=Hosd
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tommi Maekitalo 2002-12-19 09:08:11 link to latest on ftp-site
Previous Message Philip Warner 2002-12-19 06:32:24 Re: v7.3.1 tar ready ... please check it ...

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andreas Joseph Krogh 2002-12-19 09:44:04 Schema in connection URL
Previous Message Noel 2002-12-19 04:51:36 Re: error when using move, any suggestions?