日期:2014-05-16  浏览次数:20463 次

iBATIS连接数据库学习笔记
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>
连接Sql Server 2000的如下:
<transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property name="JDBC.Driver"
            value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
      <property name="JDBC.ConnectionURL"
            value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs;SelectMethod=Cursor"/> 
      <property name="JDBC.Username" value="sa"/>
      <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>