db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén (JIRA) <j...@apache.org>
Subject [jira] Resolved: (OJB-14) Setting custom JDBC driver tuning options trough jdbc-connection-descriptor
Date Tue, 26 Apr 2005 03:59:24 GMT
     [ http://issues.apache.org/jira/browse/OJB-14?page=all ]
Martin Kalén resolved OJB-14:

     Resolution: Fixed
    Fix Version: 1.0.x CVS

Not yet merged/reworked for trunk.

> Setting custom JDBC driver tuning options trough jdbc-connection-descriptor
> ---------------------------------------------------------------------------
>          Key: OJB-14
>          URL: http://issues.apache.org/jira/browse/OJB-14
>      Project: OJB
>         Type: New Feature
>   Components: RDBMS platform-specific support
>     Versions: 1.0.3, 1.1
>     Reporter: Martin Kalén
>     Assignee: Martin Kalén
>     Priority: Minor
>      Fix For: 1.0.x CVS

> Copied from Scarab OJB298 (http://issues.apache.org/scarab/issues/id/OJB298).
> Comments from Danilo Tommasina:
> "
> Several database driver need special extra paramters for adding support for special database
features like unicode support and tuning options. For this reason in JDBC there is the method
'static Connection getConnection(String url, Properties info)' that allows to feed the driver
with several tuning options.
> Looking at the repository documentation I found the <attribute> tag within <jdbc-connection-descriptor>
in the repository.xml, I though this was exactly what I needed, however this was not the case,
I have no clue what this tag is used for...
> I found no way for setting these options when OJB initialises the db connections.
> After looking at the OJB source code (release 1.0.1), it seems to me that these initialisation
method is not supported by OJB.
> The implementation of ConnectionFactoryDBCPImpl uses following code to initialise a DBCP
connection factory:
>     protected org.apache.commons.dbcp.ConnectionFactory createConnectionFactory(JdbcConnectionDescriptor
>     {
>         return new DriverManagerConnectionFactory(getDbURL(jcd), jcd.getUserName(), jcd.getPassWord());
>     }
> As you can see this code does not allow to feed the driver with the extra paramaters.
DBCP also offers the possibility to init the factory with a Properties object, the method
could be written as follows:
>     protected org.apache.commons.dbcp.ConnectionFactory createConnectionFactory( JdbcConnectionDescriptor
jcd ) {
>         Properties connProp = new Properties();
>         // Add user and password
>         connProp.put( "user", jcd.getUserName() );
>         connProp.put( "password", jcd.getPassWord() );
>         // Add custom properties
>         connProp.putAll( jcd.getAttributes() );    // METHOD getAttributes() is Missing
in JdbcConnectionDescriptor...
>         return new DriverManagerConnectionFactory( getDbURL( jcd ), connProp );
>     }
> However a method getAttributes() is missing in JdbcConnectionDescriptor (or in its super
class) not allowing a generic approach.
> The same problem probably applies to all other ConnectionFactory implementations. 
> Note: In MySQL it is possible to set these parameters in the connection URL, other databases
do not support this approach.
> "

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message