avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Mortenson <l...@silveregg.co.jp>
Subject Re: Question on connection pools
Date Thu, 07 Feb 2002 08:18:57 GMT
>
>
>I'm new to Avalon and am looking to use the connection pool that'
>Excalibur provides, although I'm a little confused as to how I'm
>actually supposed to use it.  It looks like I'm just supposed to use
>JdbcDataSource, and it'll magically handle all pooling tasks.
>
I just went ahead and checked in a JdbcDataSource example that I've had 
sitting on my computer.
It was not 100% ready for prime time documentation wise, but the example 
itself is ready.  Go into the new examples/jdbcdatasource directory and 
run build.  Then run bin\run.bat  (Still need to create a run.sh file)
Source is all there as well.  If you rebuild the excalibur docs with 
"build docs", you will find a link to what is
done so far on the documentation for the demo at the bottom of the left 
hand menu.

>
>What are my options for the connection-class parameter to
>pool-controller (I'm guessing this will be JdbcConnectionPool)?
>
Actually no, it defaults to 
"org.apache.avalon.excalibur.datasource.JdbcConnection".  I also updated 
the javadocs, so take a look checkout the latest CVS and take a look at 
the Javadocs.  Go ahead and just leave it off as the default will work.

>  What does the keep-alive option do?
>
It is used for making sure the connection is alive before allowing it to 
be allocated.  See New Javadocs for details. :-)

>Since JdbcConnectionPool implements HardResourceLimitingPool, does this
>mean that the number of connections will only grow to the max, and will
>never shrink?
>
That is correct.  Take a look at the ResourceLimitingJdbcDataSource in 
the scratchpad.  It will trim unused connections.

>Can I have multiple datasources available?  There doesn't seem to be a
>name option in the configuration for the JdbcDataSource.  How are they
>identified?
>
Take a look at the example.  You set it up by defining something like 
the following in the conponents.xml file.

    <datasources>
        <jdbc name="test-db" logger="app.jdbc">
            <pool-controller min="1" max="1">
                <keep-alive disable="true"/>
            </pool-controller>
            <auto-commit>true</auto-commit>
            <driver>org.hsqldb.jdbcDriver</driver>
            <dburl>jdbc:hsqldb:..\sqldata\example</dburl>
            <user>sa</user>
            <password></password>
        </jdbc>

        <jdbc name="another-db" logger="app.jdbc">
            <pool-controller min="1" max="1">
                <keep-alive disable="true"/>
            </pool-controller>
            <auto-commit>true</auto-commit>
            <driver>org.hsqldb.jdbcDriver</driver>
            <dburl>jdbc:hsqldb:..\sqldata\example2</dburl>
            <user>sa</user>
            <password></password>
        </jdbc>
    </datasources>

    Then you reference the different datasources using the dbpool 
element in the configurations of your components.

>My apologies if these questions would be answered if I'd just spent more
>time familiarizing myself with the Avalon Framework.  Any pointers to
>documentation would be greatly appreciated.
>
Let me know if you still have questions.

Cheers,
Leif



--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message