SQL Server 2005 Linux环境下的中文字符问题
我正在尝试使用 Linux 机器 (RHEL) 上的 Jboss 服务器托管的 Web 应用程序从 SQL Server 2005 数据库服务器获取中文字符。问题是汉字永远不会从数据库返回,而是显示一些方框。为此,我尝试了 JTDS 驱动程序以及 Microsoft 的 SqlJdbc 驱动程序。有趣的是,数据库和驱动程序的相同组合在 Windows 环境中可以正常工作,并且从结果集中以字符串形式返回中文字符。
任何有关该问题的帮助将不胜感激。
I am trying to get Chinese characters from a SQL Server 2005 database server with my web application hosted with Jboss server on a Linux box (RHEL). The issue is that the Chinese characters never get returned from the database, showing some square boxes instead. I have tried both the JTDS drivers as well as the SqlJdbc drivers from Microsoft for this. Interestingly the same combination of database and drivers works fine in a Windows environment with the Chinese characters returned in a string from the result set.
Any help on the issue would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从数据从数据库中出来的时间到数据显示在视图中的时间之间,并没有足够的信息来说明您正在对数据执行什么操作。在 Linux 和 Windows 中打印一些调试信息可能是一个好主意,以查看某些系统属性的差异,例如如果您在两种情况下输出 System.getProperty("file.encoding"),您会得到什么?
您可能想尝试使用 JAVA_OPTS=-Dfile.encoding=UTF-8。
也许下面链接中的讨论可能会有所帮助。
https://community.jboss.org/thread/155260?_sscc=t
听起来这不是与数据库/驱动程序相关的问题。
There's not really enough info about what you're doing with the data between the time it comes out of the database, and the time it gets displayed in the view. It might be a good idea to print some debug information in both Linux and Windows to see what the differences are for certain System properties, like if you output System.getProperty("file.encoding") in both scenarios, what do you get?
You might want to try using JAVA_OPTS=-Dfile.encoding=UTF-8.
Perhaps the discussion at the link below might help.
https://community.jboss.org/thread/155260?_sscc=t
It doesn't sound like this is a database/driver related problem.