ibatis查询MySQL数据库数据报错来高手指导
不要说我密码错误谢谢 我的密码很正确
以下是我的SqlIbatis.properties 文件内容
driver = com.mysql.jdbc.Driver
url = jdbc:mysql://192.168.0.220:3306/hefu_hotel
username = root
password =123456
以下是我的SqlMapConfig.xml内容
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<properties resource="com/ibatis/SqlIbatis.properties"/>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/ibatis/mapping/User.xml" />
</sqlMapConfig>
以下是我 User.xml 的内容
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
<resultMap class="com.ibatis.entity.User" id="User">
<result property="id" column="id"/>
<result property="userName" column="userName"/>
<result property="passWord" column="passWord"/>
<result property="sex" column="sex"/>
<result property="age" column="age"/>
<result property="tel" column="tel"/>
<result property="profession" column="profession"/>
<result property="mail" column="mail"/>
</resultMap>
<typeAlias alias="User" type="com.ibatis.entity.User"/>
<select id="selectUser" resultClass="User">
select * from User
</select>
</sqlMap>
以下是我的实现代码 java文件
得到SqlMapConfig.xml文件
private static SqlMapClient sqlmapClient = null;
static{
try {
Reader reader = com.ibatis.common.resources.Resources.getResourceAsReader("com/ibatis/SqlMapConfig.xml");
sqlmapClient = com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(reader);
reader.close();
} catch (
IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
调用方法实现全查
public List<User> getAllUser()&nb