[jboss-user] [JNDI/Naming/Network] - Re: configuring db2 data source

amitabhprasad do-not-reply at jboss.com
Thu Oct 19 12:20:23 EDT 2006


Here is what I have in DB2-ds.xml file located at \jboss4.0*\server\default\deploy

  <local-tx-datasource>
    <jndi-name>jdbc/abrakadabra</jndi-name>
    <connection-url>jdbc:db2://blueh006.rchland.ibm.com:60068/appvvdev</connection-url>
    <driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
    <user-name>bhcdev</user-name>
    tmp23tmp
    <min-pool-size>1</min-pool-size>
        <!-- sql to call when connection is created -->
        <new-connection-sql>select count(*) from as.cache</new-connection-sql>
        <!-- sql to call on an existing pooled connection when it is obtained from pool  -->
        <check-valid-connection-sql>select count(*) from as.cache</check-valid-connection-sql>
  </local-tx-datasource>


Corresponding entry in ejb-jar.xml is

       		<![CDATA[ExpireASPrices Bean]]>
			<ejb-name>ExpireASPrices</ejb-name>
			<local-home>products.hardware.configurator.as.emergencyfix.ExpireASPricesLocalHome</local-home>
			products.hardware.configurator.as.emergencyfix.ExpireASPricesLocal
			<ejb-class>products.hardware.configurator.as.emergencyfix.ExpireASPricesBean</ejb-class>
			<session-type>Stateless</session-type>
			<transaction-type>Bean</transaction-type>
			<resource-ref>
				
				<res-ref-name>jdbc/abrakadabra</res-ref-name>
				<res-type>javax.sql.DataSource</res-type>
				<res-auth>Container</res-auth>
				<res-sharing-scope>Shareable</res-sharing-scope>
			</resource-ref>
		
in jboss.xml file 
 
         <ejb-name>ExpireASPrices</ejb-name>
         <local-jndi-name>ejb/ExpireASPrices</local-jndi-name>
         <resource-ref>
        		<res-ref-name>jdbc/abrakadabra</res-ref-name>
        		<jndi-name>java:/abrakadabra</jndi-name>
      	 </resource-ref>
      

and referred in code as 
ctx = (ctx == null) ? new javax.naming.InitialContext() : ctx;
			ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/abrakadabra"); //$NON-NLS-1$

Let me know if I am missing any thing. This app works fine in WAS, you must have realized by now I am newbiee to JBOSS and carrying out necessary changes for porting app to run on JBOSS

Thanks again

-Amitabh


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979415#3979415

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979415



More information about the jboss-user mailing list