还是ibatis的中文乱码问题
jdk 1.6
eclipse 3.3
sqlserver2000
ibatis2.3
在执行数据插入时出现乱码。多方查找资料,仍无法解决;源码如下:
sqlMapConfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=UserDB;SelectMethod=Cursor"/>
<property name="JDBC.Username" value="sa"/>
<property name="JDBC.Password" value="sa"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/hanhl/map/User.xml"></sqlMap>
</sqlMapConfig>
User.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="User">
<select id="getuser" parameterresultresultparameterparametervalue="net.sourceforge.jtds.jdbc.Driver"/>
<property name="JDBC.ConnectionURL" value="jdbc:jtds:sqlserver://localhost:1433/UserDB;charset=UTF-8"/>后面的charset=UTF-8/GB2312可要可不要!!