Re: Configuration Pool in Cayenne

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Apr 24 2005 - 22:25:24 EDT

  • Next message: Vassilis Raxenidis: "Urgent createDataContext"

    On Apr 21, 2005, at 10:07 AM, Diego Maximiliano Iņigo wrote:

    > I have problem with the pool connection in ceyenne 1.1M6 beucase not
    > reconnect to the DB Oracle.
    >
    > Now, i like use the version cayenne 1.2M3 with pool DBCP (DataSource
    > Factory - org.objectstyle.cayenne.conf.DBCPDataSourceFactory), but i
    > don't know, how to configure apache dbcp for tomcat 4, and i don't
    > understand, DBCP properties file amd what put in this label??? 

    If you are using DBCPDataSourceFactory, then Cayenne handles
    configuration on its own and no Tomcat-specific configuration is
    needed. Just follow these steps:

    1. Create a properties file in the same directory as cayenne.xml, e.g.
    dbcp.properties.
    2. Open it in a text editor and paste contents of a sample file from
    the DBCPDataSourceFactory API docs (available with the download under
    "doc/api/cayenne/org/objectstyle/cayenne/conf/
    DBCPDataSourceFactory.html").
    3. At the minimum edit the following properties:
        * cayenne.dbcp.driverClassName
        * cayenne.dbcp.url
        * cayenne.dbcp.username
        * cayenne.dbcp.password
        * cayenne.dbcp.minIdle (the minimum number of idle connections)

    If you want to tweak it further, please read DBCP docs.

    4. Select DBCPDataSourceFactory for your factory and enter the name of
    this file in the "DBCP Properties File" field.

    ......

    As an alternative to the above you can configure a DBCP DataSource in
    Tomcat and expose it to the application via JNDI. On Cayenne side you
    shouldn't use DBCPDataSourceFactory anymore. Instead choose
    JNDIDataSourceFactory and type the name you mapped in Tomcat. Consult
    Tomcat online docs
    (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-
    examples-howto.html) or other online resources on Tomcat JNDI
    configuration.

    It is up to you which way you choose out of the two. They are
    equivalent from Cayenne standpoint and differ only in convenience in a
    particular environment.

    Andrus



    This archive was generated by hypermail 2.0.0 : Sun Apr 24 2005 - 22:25:21 EDT