Re: Setting client encoding with jdbc

From: Kris Jurka <books(at)ejurka(dot)com>
To: Brad <bradclark_98(at)yahoo(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Setting client encoding with jdbc
Date: 2003-11-10 01:59:02
Message-ID: Pine.LNX.4.33.0311092048020.20895-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7 Nov 2003, Brad wrote:

> I'm interested in changing the client encoding from within a java
> program. I'm using connection pooling and need to change it depending
> on the client's language preference. Is there a function I can call
> which changes the client encoding. Something like
>
> pStmt = con.prepareStatement("select
> pg_set_client_encoding('LATIN5'); ");
> rs = pStmt.executeQuery();
>
> I can set the client encoding from within psql by /encoding LATIN5 but
> not sure how to execute something like this from java. Any help would
> be greatly appreciated.
>

Please direct JDBC questions to the pgsql-jdbc list.

You may not set the client encoding from JDBC. The JDBC driver requires a
unicode client encoding to work properly. You may then reencode the data
in your charset of preference using the standard java APIs.

Kris Jurka

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-11-10 03:10:47 Re: [HACKERS] BEGIN vs START TRANSACTION
Previous Message Tom Lane 2003-11-10 01:47:03 Re: Coding help