You should also use 

  c.lookup("java:comp/env/jdbc/myPool")

and a resource reference in your ejb-jar.xml and jboss.xml.

cheers
dim


On Tue, 9 Oct 2001, Lennart Petersson wrote:

> But also please remember all the stuff about closing your resources in a finally 
>statement. Else you will soon come back having other problems ;-)
> /Lennart
> 
> ----- Original Message ----- 
> From: Imran Bohoran <[EMAIL PROTECTED]>
> To: Jboss-User (E-mail) <[EMAIL PROTECTED]>
> Sent: Tuesday, October 09, 2001 10:35 AM
> Subject: RE: [JBoss-user] Obtaining a Connection object through Session beans
> 
> 
> 
> yes..and this is what i was looking for. 
> 
>     DataSource datasource;
>     Context c = new InitialContext();
>     datasource = (DataSource)c.lookup("java:/myPool");
>     
>     Connection c = datasource.getConnection();
> 
> like i said peter earlier i dont think it would take a book to explain this.
> anyway thanks again to Guy for his response too. 
> 
> happy coding
> 
> Imran
> -----Original Message-----
> From: Hermann RANGAMANA [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 09, 2001 1:07 PM
> To: Jboss-User (E-mail)
> Subject: Re: [JBoss-user] Obtaining a Connection object through Session
> beans
> 
> 
> I don't see what difference you should make between accessing a datasource
> from an entity or a session bean. A datasource is bind to a jndi name, and
> you can access this datasource within a jBoss container - should it be
> session or entity bean container.
> 
> Hermann  R A N G A M A N A
> Ing�nieur Informaticien
> Primagendys SAS
> T�l : +(33) 1 43 58 27 83
> Fax : +(33) 1 43 58 27 17
> e-mail : [EMAIL PROTECTED]
> ----- Original Message -----
> From: "Peter Wone" <[EMAIL PROTECTED]>
> To: "Jboss-User (E-mail)" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 09, 2001 12:00 AM
> Subject: Re: [JBoss-user] Obtaining a Connection object through Session
> beans
> 
> 
> > > I need to access my data base through some of my session beans directly
> > > (With out going through the entity beans). how do I do this by using
> > > Connection object from the container pool of Connections.
> >
> > You won't get a useful answer to this in an email, it's too big a
> question.
> > You've basically asked for a course in using EJB 1.x.
> >
> > Go buy a book like Java Server Programming J2EE Edition, Wrox Press. There
> > are several chapters devoted to the subject.
> >
> >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 


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

Reply via email to