permaculture playing cards*
The moose likes JDBC and the fly likes MSSQL and Unicode in WIndows and Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MSSQL and Unicode in WIndows and Linux" Watch "MSSQL and Unicode in WIndows and Linux" New topic
Author

MSSQL and Unicode in WIndows and Linux

Ahsan Habib
Greenhorn

Joined: Sep 17, 2008
Posts: 22
Java application reads mssql table data (unicode data) and forward to servlet. This scenario works fine when I run application in Ubuntu. But performance changes for these following scenarios:

secnario1: i move java application to windows which forwards database data to servlet running in ubuntu. Output in java app shows question marks (unicode issue) but servlet shows them correctly.

Scenario2: move both java app and servlet to windows, now both modules displaying question marks.

What I think - it should not be problem with database data since jdbc driver in linux works fine. But when I read data from windows (using same driver, later different versions of jdbc driver), though it shows ?? but servlet in linux could manage to get unicode data. What could be the problem and what should I do?

Thank you in advance.


Ahsan Habib
SCJP5, SCWCD5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41150
    
  45
Where does it show question marks? Some kind of console? A web page? A console most likely can't display those characters. A web page needs to specify the proper encoding.

Make sure that you're specifying UTF-8 as the encoding wherever the data gets sent from one system to another.


Ping & DNS - my free Android networking tools app
Ahsan Habib
Greenhorn

Joined: Sep 17, 2008
Posts: 22
For java app, I log output into file, and I run servlet in tomcat from eclipse - so, can see output in eclipse console.

I guess i figured out the problem. It was not jdbc driver problem. I changed Standards and Formats in Regional and Language settings (windows control panel) to Thai (before it was english) and now java app logs unicode data (read from mssql table) properly in log file. But eclipse console still show question marks. Later, I switched to jetty, and eclipse console prints Thai character properly. It was tomcat limitation. Adding UTF-8 for url handling in server.xml in tomcat solved the problem.

Worth to note that I was using apache HttpClient to forward data to servlet.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MSSQL and Unicode in WIndows and Linux
 
Similar Threads
Right click popup menu
Oracle JDBC Connectivity problem
can I change JDBC Driver ?
is this tomcat problem or Driver problem?
Lost connection detection time difference