Character Sets issue with JDBC SQL Server for Polish characters


i have java app uses sql server 3.0 jdbc driver. accessing table columns defined nvarchar. tables contains rows polish characters. java app simple selects , creates xml document based upon data in table. when run app windows (xp) server, data extracted correctly. had tell jvm use utf-8 encoding.

when run same code linux (redhat 5.0)server, extracts data polish characters garbage. still set encoding jvm use utf-8. i'm not sure why behave differently windows linux.

the sql server database resides on windows (xp) server. sql server 2008.

does have ideas on why linux behave differently windows jdbc clients?

sql-server doesn't support utf-8 utf-16; however, doesn't forbid use varchar or nvarchar field store string of utf-8 characters sql-server see characters indivudual ascii (8 bit) characters. sql-server won't able sort them or return proper string length rest making equality comparaisons or storing/retrieving them, work.

for problem linux, it's quite possible data extracted correctly display wrong.  should check printing ascii (numeric) value of each character see 1 of these 2 possibilities true.

it's possible that's java app wrong in storing data; should check data has been correctly stored in database printing numerical value of individual characters.  it's not because data displayed correctly has been stored correctly.  so, use functions ascii and/or unicode; without forgetting add n before unicode strings make sure communication protocol won't mix them:

select ascii ('e'), unicode ('e'), unicode (n'é')


sylvain lafontaine, ing.
mvp - access
blog/web site: http://coding-paparazzi.sylvainlafontaine.com
independent consultant , remote programming access , sql-server (french)

<cdcyrus> wrote in message news:98299507-d4f2-4e8e-8e8d-14bc22617559@communitybridge.codeplex.com...

i have java app uses sql server 3.0 jdbc driver. accessing table columns defined nvarchar. tables contains rows polish characters. java app simple selects , creates xml document based upon data in table. when run app windows (xp) server, data extracted correctly. had tell jvm use utf-8 encoding.

when run same code linux (redhat 5.0)server, extracts data polish characters garbage. still set encoding jvm use utf-8. i'm not sure why behave differently windows linux.

sql server database resides on windows (xp) server. sql server 2008.

have ideas on why linux behave differently windows jdbc clients?



SQL Server  >  SQL Server Data Access



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'