You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Graham King <gr...@darkcoding.net> on 2005/01/05 17:59:22 UTC
[dbcp] setReadOnly always being called
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 ?
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [dbcp] setReadOnly always being called
Posted by Dirk Verbeeck <di...@pandora.be>.
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 ?