8 Replies Latest reply on Apr 7, 2011 8:43 PM by racumin

    Adding properties to Jboss JNDI DataSource

    racumin Newbie

      Hi,

       

      I'm using Jboss AS 6 with Spring 2.5.6

       

      In my applicationContext.xml, I have:

       

      <jee:jndi-lookup id="dataSource" jndi-name="java:/MyDataSource"/>

       


      This is the xml of my datasource:

       

      <local-tx-datasource>

              <jndi-name>MyDataSource</jndi-name>

              <connection-url>jdbc:oracle:thin:@<ip>:<port>:<sid></connection-url>

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

              <user-name>username</user-name>

              <password>password</password>

              <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>

              <metadata>

                  <type-mapping>oracle</type-mapping>

              </metadata>

       

       

              <idle-timeout-minutes>5</idle-timeout-minutes>

              <min-pool-size>5</min-pool-size>

              <max-pool-size>20</max-pool-size>

              <query-timeout>300</query-timeout>

              <use-fast-fail>true</use-fast-fail>

          </local-tx-datasource>

       

       

       

      Now, how do I add other properties (like read tiemout) in my datasource?

       

      When I was not using JNDI DataSource, we have something like this:

       

      <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">

                          <property name="driverClassName">

                                    <value>{driverClassName}</value>

                          </property>

                          <property name="url">

                                    <value>${url}</value>

                          </property>

                          <property name="username">

                                    <value>${username}</value>

                          </property>

                          <property name="password">

                                    <value>${password}</value>

                          </property>

                          <property name="initialSize">

                                    <value>${initialSize}</value>

                          </property>

                          <property name="maxActive">

                                    <value>${maxActive}</value>

                          </property>

                          <property name="maxIdle">

                                    <value>${maxIdle}</value>

                          </property>

                          <property name="minIdle">

                                    <value>${minIdle}</value>

                          </property>

                          <property name="maxWait">

                                    <value>${maxWait}</value>

                          </property>

                          <property name="timeBetweenEvictionRunsMillis">

                                    <value>${timeBetweenEvictionRunsMillis}</value>

                          </property>

                          <property name="numTestsPerEvictionRun">

                                    <value>${numTestsPerEvictionRun}</value>

                          </property>

                          <property name="minEvictableIdleTimeMillis">

                                    <value>${minEvictableIdleTimeMillis}</value>

                          </property>

                          <property name="maxOpenPreparedStatements">

                                    <value>${maxOpenPreparedStatements}</value>

                          </property>

                          <property name="poolPreparedStatements">

                                    <value>${poolPreparedStatements}</value>

                          </property>

                </bean>

       

       

      How do I copy the properties from the previous datasource to the one that was using JNDI?

       

       

      Thanks!