use resource-ref to map a java:/comp/env/MyDS to the appropriate actual
datasource for each bean.

david jencks

On 2002.06.06 18:50:28 -0400 David Brady wrote:
> 
> I have a live database which is kept up-to-date with system usage 
> information from the last hour.  Data older than an hour is moved to a 
> warehouse database.
> 
> A stateless bean (call it UsageBean) already exists which reads data from
> 
> the live database.  I'd like to be able to use the same bean (kinda!),
> etc 
> to read the data from the warehouse.
> 
> I've already created two datasources: UsageLiveDS, and UsageWarehouseDS.
> 
> My initial thought was to handle this all through manipulating
> ejb-jar.xml, 
> and jboss.xml - creating an ejb called UsageLive, and UsageWarehouse.
> 
> ejb-jar.xml
> 
>   <session>
>    <ejb-name>UsageLive</ejb-name>
>      <home>UsageHome</home>
>      <remote>Usage</remote>
>      <ejb-class>UsageBean</ejb-class>
>      <session-type>Stateless</session-type>
>      <transaction-type>Bean</transaction-type>
>   </session>
> 
>   <session>
>    <ejb-name>UsageWarehouse</ejb-name>
>      <home>UsageHome</home>
>      <remote>Usage</remote>
>      <ejb-class>UsageBean</ejb-class>
>      <session-type>Stateless</session-type>
>      <transaction-type>Bean</transaction-type>
>   </session>
> 
> And somehow (somewhere) map the datasources appropriately.  But I'm
> having a 
> conceptual block on how to make this work 'cause of how I get connections
> in 
> UsageBean:
> 
>      InitialContext initialCtx = new InitialContext();
>      ds = (DataSource)initialCtx.lookup("java:/jdbc/UsageLiveDS");
> 
> How do I grab a datasource without 'hardcoding' it in this class?  In
> other 
> words, how do I dynamically map a datasource using ejb-jar.xml, and 
> jboss.xml, and have a stateless bean use this datasource?
> 
> Thanks in advance.
> 
> David
> 
> 
> 
> 
> 
> 
> 
> _________________________________________________________________
> Join the world�s largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
> _______________________________________________________________
> 
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to