pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedLoad UTF8@psql into latin1@mysql through JDBC
5+ messages / 2 participants
[nested] [flat]
* Load UTF8@psql into latin1@mysql through JDBC
@ 2012-12-12 17:13 Emi Lu <emilu@encs.concordia.ca>
0 siblings, 1 reply; 5+ messages in thread
From: Emi Lu @ 2012-12-12 17:13 UTC (permalink / raw)
To: pgsql-sql
Good morning,
Is there a simple way to load UTF8 data in psql to mysql(with latin1
encoding) through JDBC?
Thanks a lot!
Emi
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Load UTF8@psql into latin1@mysql through JDBC
@ 2012-12-12 17:33 Adrian Klaver <adrian.klaver@gmail.com>
parent: Emi Lu <emilu@encs.concordia.ca>
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Klaver @ 2012-12-12 17:33 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: pgsql-sql
On 12/12/2012 09:13 AM, Emi Lu wrote:
> Good morning,
>
> Is there a simple way to load UTF8 data in psql to mysql(with latin1
> encoding) through JDBC?
This would seem to be dependent on the MySQL JDBC adapter.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Load UTF8@psql into latin1@mysql through JDBC
@ 2012-12-12 17:47 Emi Lu <emilu@encs.concordia.ca>
parent: Adrian Klaver <adrian.klaver@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Emi Lu @ 2012-12-12 17:47 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@gmail.com>; +Cc: pgsql-sql
>> Is there a simple way to load UTF8 data in psql to mysql(with latin1
>> encoding) through JDBC?
>
> This would seem to be dependent on the MySQL JDBC adapter.
>
>>From here:
>
> http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-charsets.html
>
> "All strings sent from the JDBC driver to the server are
> converted automatically from native Java Unicode form to
> the client character encoding, including all queries sent.... "
This does not help. The reason I asked this is because through mybatis +
JDBC, loading data from psql@utf8 to mysql@latin1, the french character
cannot be auto-loaded.
Thanks.
--
Emi
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Load UTF8@psql into latin1@mysql through JDBC
@ 2012-12-12 18:06 Emi Lu <emilu@encs.concordia.ca>
parent: Emi Lu <emilu@encs.concordia.ca>
1 sibling, 0 replies; 5+ messages in thread
From: Emi Lu @ 2012-12-12 18:06 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@gmail.com>; +Cc: pgsql-sql
On 12/12/2012 12:47 PM, Emi Lu wrote:
>>> Is there a simple way to load UTF8 data in psql to mysql(with latin1
>>> encoding) through JDBC?
>>
>> This would seem to be dependent on the MySQL JDBC adapter.
>>
>>> From here:
>>
>> http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-charsets.html
>>
>>
>> "All strings sent from the JDBC driver to the server are
>> converted automatically from native Java Unicode form to
>> the client character encoding, including all queries sent.... "
>
> This does not help. The reason I asked this is because through mybatis +
> JDBC, loading data from psql@utf8 to mysql@latin1, the french character
> cannot be auto-loaded.
>
JAVA codes work for most of characters, but not "-È". Someone knows why
the following codes cannot load "-È" to mysql@latin1?
Thanks a lot!
--
public static String utf8_to_latin1(String str)
throws Exception
{
try
{
String stringToConvert = str;
byte[] convertStringToByte = stringToConvert.getBytes("UTF-8");
return new String(convertStringToByte, "ISO-8859-1");
}catch(Exception e)
{
log.error("utf8_to_latin1 Error: " + e.getMessage());
log.error(e);
throw e;
}
}
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Load UTF8@psql into latin1@mysql through JDBC
@ 2012-12-12 19:34 Adrian Klaver <adrian.klaver@gmail.com>
parent: Emi Lu <emilu@encs.concordia.ca>
1 sibling, 0 replies; 5+ messages in thread
From: Adrian Klaver @ 2012-12-12 19:34 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: pgsql-sql
On 12/12/2012 09:47 AM, Emi Lu wrote:
>>> Is there a simple way to load UTF8 data in psql to mysql(with latin1
>>> encoding) through JDBC?
>>
>> This would seem to be dependent on the MySQL JDBC adapter.
>>
>>> From here:
>>
>> http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-charsets.html
>>
>>
>> "All strings sent from the JDBC driver to the server are
>> converted automatically from native Java Unicode form to
>> the client character encoding, including all queries sent.... "
>
> This does not help. The reason I asked this is because through mybatis +
> JDBC, loading data from psql@utf8 to mysql@latin1, the french character
> cannot be auto-loaded.
You might get an answer sooner at:
https://groups.google.com/group/mybatis-user
>
> Thanks.
> --
> Emi
>
>
--
Adrian Klaver
adrian.klaver@gmail.com
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2012-12-12 19:34 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-12-12 17:13 Load UTF8@psql into latin1@mysql through JDBC Emi Lu <emilu@encs.concordia.ca>
2012-12-12 17:33 ` Adrian Klaver <adrian.klaver@gmail.com>
2012-12-12 17:47 ` Emi Lu <emilu@encs.concordia.ca>
2012-12-12 18:06 ` Emi Lu <emilu@encs.concordia.ca>
2012-12-12 19:34 ` Adrian Klaver <adrian.klaver@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox