1.appcontext-common.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>${jdbc.database.driver}</value>
</property>
<property name="url">
<value>${jdbc.database.url}</value>
</property>
<property name="username">
<value>${jdbc.database.username}</value>
</property>
<property name="password">
<value>${jdbc.database.password}</value>
</property>
</bean>
2.appcontext.xml
<bean id="resMonitorDao"
class="com.zltel.zjmonitor.resmonitor.dao.ibatis.ResMonitorDaoImpl"
parent="baseIbatisDao">
</bean>
<bean id="resMonitorService"
class="com.zltel.zjmonitor.resmonitor.service.impl.ResMonitorServiceImpl">
<property name="resMonitorDao">
<ref local="resMonitorDao" />
</property>
</bean>
ibatis查询方法:
private static final String NAMESPACE = "resMonitor."
public List<MonitorType>queryMonitorTypeForList() {
return this.getSqlMapClientTemplate().queryForList(
NAMESPACE + "queryMonitorTypeForList")
}
IBatis连接Oracle连接如下: <transactionManager type="JDBC"> <dataSource type="SIMPLE"> <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/> <property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@localhost:1521:oradb"/> <property name="JDBC.Username" value="用户名"/> <property name="JDBC.Password" value="密码"/> <property name="Pool.MaximumActiveConnections" value="10"/> <property name="Pool.MaximumIdleConnections" value="5"/> <property name="Pool.MaximumCheckoutTime" value="120000"/> <property name="Pool.TimeToWait" value="500"/> <property name="Pool.PingQuery" value="select 1 from ACCOUNT"/> <property name="Pool.PingEnabled" value="false"/> <property name="Pool.PingConnectionsOlderThan" value="1"/> <property name="Pool.PingConnectionsNotUsedFor" value="1"/> </dataSource> </transactionManager>欢迎分享,转载请注明来源:内存溢出
评论列表(0条)