[ http://issues.apache.org/jira/browse/OJB-14?page=all ]

Martin Kal�n updated OJB-14:
----------------------------

    Version: 1.0.3
             1.1
                 (was: 1.1 CVS)

> 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 jcd)
>     {
>         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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to