--- Scott Tavares <[EMAIL PROTECTED]> wrote:
> ----- Original Message -----
> From: george stewart <[EMAIL PROTECTED]>
> To: Turbine <[EMAIL PROTECTED]>
> Sent: Monday, January 17, 2000 6:38 PM
> Subject: Re: OPaL init in Turbine.doGet() and more
> 
> 
> <snip>
> > Move the db stuff from persistence broker to
> > dbconnection, and let it percolate up.  Then, you
> > don't need the catch/finally junk.
> >
> 
> could you explain this a bit more so that i can get
> a better understanding
> of what you mean? TIA.
I'll try to get back to you on this over the weekend.
Too much for now.

> >
> > In an earlier mail, I gave Scott a db class and a
> > hand-coded class map.  Only thing missing is the
> > pooling code.  Marc Minch would let apache use
> his.
> >
> >
> 
> well i remember talking to you about the hand-coded
> class map but i do not
> believe you ever sent it to me. could you give me
> the link to Marc's page?
> i'd like to at leased take a look at it and if i see
> that it has significant
> advantages over Turbine's db pooling (which will be
> very difficult to do) i
> will help you lobby to get in, that is if Marc
> agrees to put under the
> Apache license.
If time permits, I'll put a working sample up this
week.

Here's the link and an implementation of the
interface:

package org.apache.turbine.opl.database;

/**
 *
 * This class provides a concrete implementation of
DbBroker
 * with DbConnectionBroker providing the broker's
functionality.
 * DbConnectionBroker is authored by Marc Mnich, and
may be obtained 
 * at <a
href=http://javaexchange.com>http://javaexchange.com</a>.
 *
 * @author  George Stewart
 * 
 */

// JDK Classes
import java.util.*;
import java.sql.*;

// Java Exchanges broker
import
com.javaexchange.dbConnectionBroker.DbConnectionBroker;

public class JavaExchangeBroker implements DbBroker 
{
    Properties properties;

    public JavaExchangeBroker() {
        
    }

    private DbConnectionBroker broker = null;

    /**
       Intitialize the broker.
       JavaExchange requires the driver, server,
login, password,
       minimum connections, maximum connectiosn
       log file name, and the maximum connection time.
     */
    public void init(Properties properties) throws
Exception
    {
        broker = new DbConnectionBroker(
            properties.getProperty("dbDriver"),
            properties.getProperty("dbServer"),
            properties.getProperty("dbLogin"),
            properties.getProperty("dbPassword"),
           
Integer.parseInt(properties.getProperty("minConns")),
           
Integer.parseInt(properties.getProperty("maxConns")),
            properties.getProperty("logFileString"),
            new
Double(properties.getProperty("maxConnTime")).doubleValue());
     }

    public java.sql.Connection getConnection()
    {
        return broker.getConnection();
    }
        
    public void freeConnection(java.sql.Connection
conn)
    {
        broker.freeConnection(conn);
    }

    public void destroy()
    {
        if (broker != null) 
        {
            synchronized (JavaExchangeBroker.class)
            {
                if (broker != null) 
                    broker.destroy();
                broker = null;
            }
        }
    }
}

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to