1 Reply Latest reply on Feb 17, 2012 11:23 AM by peterj

    Datasource

    ortolanph

      Hi all

       

           I have my datasources-ds.xml with the following contents:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <datasources>

        <local-tx-datasource>

          <jndi-name>MyConnection1</jndi-name>

       

          <connection-url>jdbc:oracle:thin:@server:port:SID1</connection-url>

          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

          <user-name>myuser</user-name>

          <password>secret</password>

       

          <min-pool-size>20</min-pool-size>

          <max-pool-size>100</max-pool-size>

          <idle-timeout-minutes>20</idle-timeout-minutes>


          <new-connection-sql>select 1 from dual</new-connection-sql>

        </local-tx-datasource>

       

        <local-tx-datasource>

          <jndi-name>MyConnection2</jndi-name>


          <connection-url>jdbc:oracle:thin:@server2:port:SID2</connection-url>

          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

          <user-name>myotheruser</user-name>

              <password>anothersecret</password>

       

          <min-pool-size>20</min-pool-size>

          <max-pool-size>100</max-pool-size>

          <idle-timeout-minutes>20</idle-timeout-minutes>


          <new-connection-sql>select 1 from dual</new-connection-sql>

         </local-tx-datasource>

      </datasources>

       

               I am using jboss 4.2.3.GA with Java 6 on Linux Ubuntu 10.04.

       

               My application is using java:MyConnection2 as the datasource on my Hibernate configuration. I have to let MyConnection1 recorded in case I use this on the future.

       

               What will happen? JBOSS will open both connections, if valid, and let it open untill it is down or JBOSS will open connections on demand and when I access my application it'll open only MyConnection2?

       

               Please, tell me if it was clear.

       

      Thanks!

        • 1. Re: Datasource
          peterj

          The app server will not open any connections until asked, When an app opens a connection, then the app server will establish min-pool-zise connections, For example, if an app asks for MyConnection2, then 20 of those connections will be made. No connections for MyConnection1 will be make until an app asks for one.