commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [dbcp] setReadOnly always being called
Date Sun, 09 Jan 2005 21:32:46 GMT
In the 1.2 dbcp release a constructor was made available with
"Boolean defaultReadOnly" so it is possible to set it to "null".
http://jakarta.apache.org/commons/dbcp/xref/org/apache/commons/dbcp/PoolableConnectionFactory.html#192

By the way, a couple of months ago I made my own 
DBCPConnectionProvider for Hibernate. (attached)
It should compile on both Hibernate2 and 3 (if you adjust the import 
statements).

It it using the BasicDatasource implementation just like you would use 
with tomcat. The only tricky part is to copy/translate the hibernate 
property names into the dbcp names. But using this implementation you 
can use all properties defined on the configuration page without extra 
coding.

Cheers
Dirk


Graham King wrote:

>  Using Hibernate, DBCP and Sybase I am getting the following warning 
> from Hibernate:
> 
>    010SK: Database cannot set connection option SET_READONLY_FALSE
> 
>  This is because DBCP's PoolableConnectionFactory.activateObject(..) 
> method is calling 'setReadOnly' on the Connection and the database does 
> not support it. Hibernate spots the warning and logs it.
> 
>  There is a guard in the 'activateObject' method to only call 
> setReadOnly if '_defaultReadOnly' is not null. All the constructors of 
> PoolableConnectionFactory set '_defaultReadOnly' to a 'boolean' so it 
> will never be null.
> 
>  This goes against what the docs 
> (http://jakarta.apache.org/commons/dbcp/configuration.html) say about 
> the defaultReadOnly config parameter:  "If not set then the setReadOnly 
> method will not be called".
> 
>  Has anyone else come across this ? Is there a workaround ? Should I log 
> this as a bug ?
> 
>  Thanks in advance,
>  Graham King.
> 
> PS: If you replied directly to me about this topic previously could you 
> re-send please ?


Mime
View raw message