Saturday, 23 April 2016

What is iBatis configuratin file ?


Create an XML configuration file with name SqlMapConfig.xml where you need to provide all configurations required for iBatis.
It is important that the files SqlMapConfig.xml and other mapping files (like, Employee.xml) should be present in the class path.

Basic contents of SqlMapConfig.xml
<sqlMapConfig>
 <settings useStatementNamespaces="true" />
 <transactionManager type="JDBC">
  <dataSource type="SIMPLE">
   <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
   <property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost:3306/testdb"/>
   <property name="JDBC.Username" value="root"/>
   <property name="JDBC.Password" value="root"/>
  </dataSource>
  </transactionManager>
 <sqlMap resource="Employee.xml"/>
</sqlMapConfig>


Other properties for SqlMapConfig.xml
<property name="JDBC.AutoCommit" value="true" />
<property name="Pool.MaximumActiveConnections" value="10" />
<property name="Pool.MaximumIdleConnections" value="5" />
<property name="Pool.MaximumCheckoutTime" value="150000" />
<property name="Pool.MaximumTimeToWait" value="500" />
<property name="Pool.PingQuery" value="select 1 from Employee" />
<property name="Pool.PingEnabled" value="false" />

No comments:

Post a Comment

Note: only a member of this blog may post a comment.