一、url配置方式(2种)
1、SID方式
2、SERVICE_NAME方式
jdbc:oracle:thin:@host:port:SERVICE_NAME
如:jdbc:oracle:thin:@21.8.129.136:1521:mmver
二、其他注意事项
1、mapper.xml中的sql语句不能以分号(;)结尾,否在执行过程中会报错。
2、*Mapper接口如果返回的是List如List,即便是sql语句本身返回是空集合,接口的返回结果的集合size均为1,且唯一的值为泛型类型的默认值。
3、oracle+ibatis若返回值类型为Map,且查询字段有别名,若想通过别名get到对应的value值,sql语句在定义别名时需将别名用双引号包裹起来,因为oracle在返回时将全部字段转为大写了,或者在get的时候用大写的字段作为key值。
<select id="getMap" resultType="java.util.Map">
select username as "name" from user where id = 1;
</select>
String name = map.get(“name”);
<select id="getMap" resultType="java.util.Map">
select username as name from user where id = 1;
</select>
String name = map.get(“NAME”);