Re: How to insert Chinese (big5) through JDBC? - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: How to insert Chinese (big5) through JDBC?
Date
Msg-id Pine.LNX.4.33.0307310632300.19468-100000@leary.csoft.net
Whole thread Raw
In response to Re: How to insert Chinese (big5) through JDBC?  (Eric Tan <neltan2002@yahoo.com.hk>)
Responses Re: How to insert Chinese (big5) through JDBC?
List pgsql-jdbc

On Thu, 31 Jul 2003, [big5] Eric Tan wrote:

> The command only work in command prompt - putty":
> ALTER DATABASE "CA_care" SET client_enconding TO 'big5';
>
> But it fail when inserting from jsp & VB.
> I have to run this code in all program which may access database.
> pgsql.execute("set client_encoding to 'Big5';");
>
> Any other solution?

The idea is that you run the ALTER DATABASE command once and then every
time you connect it will already be set, so you do not need to make that
call in your client.  Notice the second time I connect the client_encoding
is already set.

jurka@doug:~$ psql tantest
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

tantest=# show client_encoding;
 client_encoding
-----------------
 SQL_ASCII
(1 row)

tantest=# alter database tantest set client_encoding to big5;
ALTER DATABASE
tantest=# \q
jurka@doug:~$ psql tantest
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

tantest=# show client_encoding;
 client_encoding
-----------------
 big5
(1 row)



To check if you have correctly run the ALTER DATABASE statement, check

SELECT datconfig FROM pg_database WHERE datname='<dbname>';

You should see
tantest=# select datconfig FROM pg_database where datname='tantest';
       datconfig
------------------------
 {client_encoding=big5}
(1 row)


Kris Jurka



pgsql-jdbc by date:

Previous
From: Eric Tan
Date:
Subject: Re: How to insert Chinese (big5) through JDBC?
Next
From: Rich Cullingford
Date:
Subject: SSL support in PG 7.4