Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with useUnicode and characterEncoding

 
Jon Su
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a project that requires to insert simplified Chinese chars to tables in MS SQL Server v7.

Have no problem to log onto the server with the following connection:

jdbc:jtds:sqlserver://192.168.0.3:1433/armcodatadevice (of course along with
username and password)

but the records inserted are bunch of ???s, which should've been Chinese chars.

Then I learned that I should specify character set and encoding. So I did the following:

jdbc:jtds:sqlserver://192.168.0.3:1433/armcodatadevice?useUnicode=true&character
Encoding=UTF8 (with the same username and password)

This time I cannot even logon to the server. I got the following error msg:

java.sql.SQLException: Cannot open database requested in login 'armcodatadevice?useUnicode=true&characterEncoding=UTF8'. Login fails.

Could anyone please tell me where I did wrong?

Thanks,





 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i think you come from mysql world , in mysql you can use useUnicode and characterEncoding for handling unicode characters.
but in sql server , you should use NChar , Nvarchar ,Ntext to store unicode data into database.
i think you used simple text, char , varchar type for your database design.


hth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic