Connection Pooling - Interesting requirement

Discussions

EJB programming & troubleshooting: Connection Pooling - Interesting requirement

  1. Connection Pooling - Interesting requirement (2 messages)

    Hi,

    As we all know, the application server creates connection objects and keep it in the connection pool for the EJB to use.

    In general, as soon as we make sql sessions with databases through sql plus or TOAD or any other software, we can do some connection level settings. One example can be in Sybase, "set arithabort numeric_truncation off", will do some setting regarding precision. This is for one session, i.e, for a connection.

    Such kind of settings, we need to do for connections when the application server creates connections and keep it in the Connection Pool. I expect your valuable suggestions regarding this.

    Thank you in advance.

    Thanks,
    Karthik.
  2. Karthik,

    the connection pool logic is implemented by the various data source objects which are vendor specific. for eg : Oracle has OracleDataSource and sybase SybDataSource. it is these objects u register with the jndi service. most of the data source objects use java bean pattern and have setters for the specific properties u talked about. so if a database vendor does provide a setter to customize a specific property u can go ahead and do it. just create a object, set the properties and register the object with the jndi service.


    kapil
  3. You can't count on having direct access to the database provided connection pool. Some App servers (i.e, iPlanet) only gives you access to it's own data source object, which uses the DB vendor data source implementation but doesn't expose it.
    If you want a totally flexible solution, you can write your own "MyDataSource" which uses the "OracleDataSource" to get connections, changes their settings, and hand them to the App server. Then you register this data source with the server as if you were the DB connector provider.
    Btw - never tried this myself :)

    Gal