How to specify the character encoding of Mybatis?

1.8k views Asked by At

Here is the problem.
There is a fact table in Kylin which has a column named "name".
When I access the table just using jdbc, everything is ok.
Then I use Mybatis to connect the same jdbcUrl.
But I get a mess when I read the column "name".
I don't know why.

1

There are 1 answers

0
Hao On

It turns out a problem about Maven.The "JDBC program" was started directly in IDE, while the "Mybatis program" was started by "mvn test".The problem is solved by adding a property in pom.xml as showed below.

<argLine>-Dfile.encoding=UTF-8</argLine>