Re: JDBC to load UTF8@psql to latin1@mysql

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: JDBC to load UTF8@psql to latin1@mysql
Date: 2012-12-12 22:38:37
Message-ID: kab10p$gnl$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Emi Lu wrote on 12.12.2012 17:17:
> Good morning,
>
> Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC?

All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString() to insert/update the data on the target database.

The JDBC drivers will handle all the conversion.
Do NOT manually convert the data.

getString() and setString() will do everything correctly.

Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message yinminmin 2012-12-13 01:21:24 Re: Looking for cooperators
Previous Message Yamen LA 2012-12-12 21:54:23 Re: Deleting WAL archives and pg_xlog when there is not a shared drive