Ivan Jozsef Balazs wrote:
Gabor Beke wrote:
The point here is, that setting up java client side for transferring into mysql database without the user have to configure anything. So once the user gives the sql user/pass everything else going automaticly. Its needed because on default, java's default charset isnt latin2, so isnt enough to setting up mysql database to latin2 utf8 if you put data through a java program.
There is a default (platform) encoding, but that applies to the byte stream to (or from) character stream encoding. The JDBC API works in the term of strings, and JDBC takes care of the encoding itself. According to my experience (admittedly with Oracle thin driver) it was neither possible nor necessary to fiddle around with the JDBC encoding.
Paul Clapham wrote:If I recall correctly, my solution was just to configure MySQL to use UTF-8 as its default character set when I installed it. (That did require exporting all of the data, reinstalling MySQL with the "use UTF-8" option, and then reimporting all of the data.) I don't have anything in my connection string which mentions Unicode or any charset at all, and I don't have any SQL code which mentions charsets either.
And I do have place names from Slovakia and Iceland in my tables, so I have pretty good test data. Haven't been to Hungary yet but I would like to get there one day.
Dropping and recreating the table right after connection means that you'll lose all data from previous runs of your application. Might be good for testing, but definitely not for production code, unless you're creating some kind of temporary tables this way.