0

I'm making a Java program and trying to retrieve chinese character from MSSQL and Im using Mybatis instead of pure jdbc class. So, I set xml file to set up basic informations

<transactionManager type="JDBC"/>
        <dataSource type="POOLED">
            <property name="driver" value="${source.db.driver.class}" />
            <property name="url" value="${source.db.url}" />
            <property name="username" value="${source.db.username}" />
            <property name="password" value="${source.db.password}" />
            <property name="driver.encoding" value="EUC-KR"/>
        </dataSource>

Everything works fine. However all chinese characters I retrieve are bunches of symbols, not perfect chinese character... How can I fix this??

Leo
  • 822
  • 2
  • 11
  • 22
  • Can you provide the code with which your retrieving the data? And also how you output it. Maybe your code doesn't read it as UTF-8 or stuff like that. – Zabuzard Oct 17 '17 at 01:50
  • `driver.encoding=UTF8` according to the documentation or more properly `` per http://www.mybatis.org/mybatis-3/configuration.html. Java should be ok with UTF-8 unless you're spitting it out on a `cmd` terminal, then you may want to try a different output mechanism. https://stackoverflow.com/a/24841904/3196753 – tresf Oct 17 '17 at 02:01
  • I added to the below. but error message " Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. comes out – Leo Oct 17 '17 at 02:14
  • @heesu - Check the data types of the columns containing the Chinese characters. If they are NVARCHAR (Unicode) then specifying 'EUC-KR' encoding is almost certainly not going to work. Trying to use UTF-8 encoding will also likely be problematic because SQL Server uses UTF-16LE encoding, not UTF-8. (Also, when posting a comment as a reply, be sure to use an "@..." mention like I did at the beginning of this comment.) – Gord Thompson Oct 17 '17 at 15:14
  • Hi, did you solve this? – JLT Feb 06 '18 at 12:34

0 Answers0