Download tyrex. It's not included by default in 4.1.x.  Also, add a
factory parameter and reference the DataSource factory of Tyrex, since
it is no longer the default DataSource factory of Tomcat (DBCP is).

- Andrew

-----Original Message-----
From: Jakarta Tomcat Newsgroup
[mailto:@[EMAIL PROTECTED]] 
Sent: Monday, July 08, 2002 7:55 PM
To: [EMAIL PROTECTED]
Subject: Tyrex 1.0 and Getting a Connection Pool in 4.1.x


Subject: Tyrex 1.0 and Getting a Connection Pool in 4.1.x
From: "Matt Raible" <[EMAIL PROTECTED]>
 ===
In Tomcat 4.0.x, I am able to get a database connection via JNDI using
the following code:

import tyrex.jdbc.xa.EnabledDataSource;

    public Connection getPooledConnection() throws
ServiceLocatorException
    {
        try {
            Context initCtx = new InitialContext();
            Context envCtx = (Context) initCtx.lookup("java:comp/env");
            ds = (EnabledDataSource) envCtx.lookup(Constants.JNDI_DB);
        } catch (NamingException ex) {
            logCat.error("NamingException: " + ex.getMessage());
            throw new ServiceLocatorException(ex);
        }

        try {
            con = ds.getConnection();
        } catch (SQLException ex) {
            logCat.error("SQLException: " + ex.getMessage());
            throw new ServiceLocatorException(ex);
        }
        return con;
    }

What do I need to change for this to work in 4.1.x?  Is there any way to
make the changes backward compatible with 4.0.x?

Thanks,

Matt



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to