What I've posted works for me, if there are corrections to be made please
post the details.

-Peace
Dave


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of 
> Toby Allsopp
> Sent: Monday, May 07, 2001 7:39 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] DataSource problems solved.
> 
> 
> On Mon, May 07, 2001 at 07:16:33PM -0600, Dave King (WebEKG) wrote:
> > Thanks Guy.  
> > 
> > Any chance we could have something like this added to the 
> faq or the how
> > twos?
> > 
> > How to get a DataSource from a pool via JNDI.
> > 
> > 1) get your pool installed (see existing docs)
> > 
> > 2) Hard code the name of the pool.
> > this is the quick and dirty way.
> > 
> > in ejb-jar.xml you need something like 
> > 
> >             <session>
> >                     <ejb-name>SequenceBean</ejb-name>
> >                     <home>demo.ejb.SequenceHome</home>
> >                     <remote>demo.ejb.Sequence</remote>
> >                     <ejb-class>demo.ejb.SequenceBean</ejb-class>
> >                     <session-type>Stateless</session-type>
> >                     <transaction-type>Container</transaction-type>
> >                     <resource-ref>
> >                             <description>the db for key
> > sequences</description>
> >     
> > <res-ref-name>java:/SQLServerPool</res-ref-name>
> >                             
> <res-type>javax.sql.DataSource</res-type>
> >                             <res-auth>Container</res-auth>
> >                     </resource-ref>
> >             </session>
> > 
> > the important part is res-ref-name, where SQLServerPool is 
> the name of your
> 
> This resource-ref section does nothing for you.  If you want 
> the quick and
> dirty way, don't even bother telling the deployer about it.
> 
> > pool.  In jboss.jcml your pool mbean starts looks like.
> > <mbean code="org.jboss.jdbc.XADataSourceLoader"
> > name="DefaultDomain:service=XADataSource,name=SQLServerPool">
> > the important part (for our purpose here) is 
> > name=SQLServerPool"
> > 
> > your code should look something like
> >     
> >     InitialContext context = new InitialContext();
> >     DataSource ds = 
> (DataSource)context.lookup("java:/SQLServerPool");
> >     
> > test.
> > 
> > 3) Move up a level of indirection with jboss.xml
> >    jboss.xml need to be beside ejb-jar.xml in meta-inf
> >    for a new project all it needs is
> > 
> > <jboss>
> >     <resource-managers>
> >             <resource-manager>
> >                     
> <res-jndi-name>java:/SQLServerPool</res-jndi-name>
> >                     <res-name>jdbc/sequence</res-name>
> >             </resource-manager>
> >     </resource-managers>
> > </jboss>   
> 
> You're missing a level of indirection here.  I forget the 
> details, but the
> DTD is fairly clear.
> 
> Toby.
> 
> _______________________________________________
> 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

Reply via email to