how did you map a datasource in to the jndi namespace? i've been trying to
accomplish this in jrun for a while... i can see no way to do it from the
jrun docs.
| chris wilson || web dev ||| www.wondergeek.com || |
> -----Original Message-----
> From: Marcelo Bellezo [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 16, 2000 12:29 PM
> To: JRun-Talk
> Subject: Re: Aquiring a JDBC connection resource from within an EJB
>
>
>
> --------------BA11068EFEA16C57769C01B7
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hi Jay,
>
> no, you can use JNDI, I'm using the following:
>
> /**
> * Gets current connection to the connection pool.
> *
> * @return Connection
> * @exception javax.ejb.EJBException
> * if there is a communications or
> systems failure
> */
> private Connection getConnection()
> throws SQLException{
> InitialContext initCtx = null;
> DataSource ds = null;
> try {
> initCtx = new InitialContext();
> ds =
> (javax.sql.DataSource)initCtx.lookup("java:comp/env/jdbc/dsnname");
> this.conn = ds.getConnection();
>
> } catch(NamingException ne) {
> System.out.println("UNABLE to get a connection from
> dsnname Pool!");
> System.out.println("Please make sure that you have
> setup the connection pool
> properly");
> System.out.println(ne);
> } finally {
> try {
> if(initCtx != null) initCtx.close();
> } catch(NamingException ne) {
> System.out.println("Error closing context: " + ne);
> System.out.println(ne);
> }
> }
> return this.conn;
> }
>
> Regard's
>
> Marcelo Bellezo
>
> Jay Walters wrote:
>
> > >From the docs it looks like the only valid way to do this
> inside JRun is
> > ResourceManager.getConnection, and that I cannot use a JNDI
> lookup? Is this
> > true?
> >
> > Cheers
> >
> ------------------------------------------------------------------
> ------------
> > Archives: http://www.egroups.com/group/jrun-interest/
> > Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> > or send a message to [EMAIL PROTECTED] with
> 'unsubscribe' in the body.
>
> --------------BA11068EFEA16C57769C01B7
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hi Jay,
> <p>no, you can use JNDI, I'm using the following:
> <p> /**
> <br> * Gets current connection to the connection pool.
> <br> *
> <br> *
> @return  
> ;
> Connection
> <br> *
> @exception &n
> bsp;
> javax.ejb.EJBException
> <br>
> *  
> ;  
> ;
> if there is a communications or systems failure
> <br> */
> <br> private Connection getConnection()
> <br> throws SQLException{
> <br> InitialContext initCtx =
> null;
> <br> DataSource ds = null;
> <br> try {
> <br>
> initCtx = new InitialContext();
> <br>
> ds = (javax.sql.DataSource)initCtx.lookup("java:comp/env/jdbc/dsnname");
> <br>
> this.conn = ds.getConnection();
> <p> } catch(NamingException ne)
> {
> <br>
> System.out.println("UNABLE to get a connection from dsnname Pool!");
> <br>
> System.out.println("Please make sure that you have setup the connection
> pool properly");
> <br>
> System.out.println(ne);
> <br> } finally {
> <br>
> try {
> <br> &n
> bsp;
> if(initCtx != null) initCtx.close();
> <br>
> } catch(NamingException ne) {
> <br> &n
> bsp;
> System.out.println("Error closing context: " + ne);
> <br> &n
> bsp;
> System.out.println(ne);
> <br>
> }
> <br> }
> <br> return this.conn;
> <br> }
> <p>Regard's
> <p>Marcelo Bellezo
> <p>Jay Walters wrote:
> <blockquote TYPE=CITE>>From the docs it looks like the only valid way to
> do this inside JRun is
> <br>ResourceManager.getConnection, and that I cannot use a JNDI
> lookup?
> Is this
> <br>true?
> <p>Cheers
> <br>--------------------------------------------------------------
> ----------------
> <br>Archives: <a
> href="http://www.egroups.com/group/jrun-interest/">http://www.egro
> ups.com/group/jrun-interest/</a>
> <br>Unsubscribe: <a
> href="http://www.houseoffusion.com/index.cfm?sidebar=lists&body=li
> sts/jrun_talk">http://www.houseoffusion.com/index.cfm?sidebar=list
> s&body=lists/jrun_talk</a>
> <br>or send a message to [EMAIL PROTECTED] with
> 'unsubscribe'
> in the body.</blockquote>
> </html>
>
> --------------BA11068EFEA16C57769C01B7--
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.