Use this in your code:
Connection connection =
((DataSource)(new
InitialContext()).lookup("java:comp/env/jdbc/metricsDB")).getConnection();
And this in your jboss.jcml:
<!-- JDBC -->
<mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
<attribute
name="Drivers">oracle.jdbc.driver.OracleDriver,org.hsql.jdbcDriver,org.enhyd
ra.instantdb.jdbc.idbDriver</attribute>
</mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=metricsDB">
<attribute name="PoolName">metricsDB</attribute>
<attribute
name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImp
l</attribute>
<attribute name="URL">jdbc:oracle:thin:@your-server:1521:yourDBtribute>
<attribute name="JDBCUser">userid</attribute>
<attribute name="Password">password</attribute>
</mbean>
----- Original Message -----
From: "purushottam naktode" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 03, 2001 2:21 PM
Subject: [JBoss-user] how to get connection from a connection pool
> Hi,
> How do I obtain connection from the connection pool.
> I am using oracle database, and oracle thin driver.
>
> I get connection if I look up the Datasource ::
> InitialContext jndiContext = new InitialContext();
> javax.sql.DataSource ds = (javax.sql.DataSource)
> jndiContext.lookup("java:/OracleDS");
> con = ds.getConnection();
> Instead I want to get the connection from the
> connection pool.Please suggest.
>
> Thanks for your time and help.
> Puru.
>
>
>
>
>
>
>
>
> =====
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user