You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Andras Balogh <an...@reea.net> on 2006/08/28 11:54:57 UTC
SharedPoolDataSourceFactory problem
Hello,
We have developed a web application with Torque3-2.
We have tested the scenario of stopping the DB server than restarting.
The web application should "discover" that
the Connections in the pool are broken, drop them and create new ones.
For this we used these value torque.properties:
torque.dsfactory.bookstore.pool.testOnBorrow=true
torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
As described here:
http://db.apache.org/torque/releases/torque-3.2/runtime/reference/initialisation-configuration.html
This is not working as expected, we see this in our log:
Property: testOnBorrow value: true is not supported by DataSource:
org.apache.commons.dbcp.datasources.SharedPoolDataSource
Property: validationQuery value: SELECT 1 is not supported by
DataSource: org.apache.commons.dbcp.datasources.SharedPoolDataSource
I see the properties are passed to the apache dbcp datasource in this
method:
AbstractDataSourceFactory.setProperty but I don't know where should be
the error, the error is catched but the stack trace is not provided olny
an error
in the log.
So there is no way to tell Torque to check for connections in the pool
and drop them if they are invalid.
Can we set these properties somehow using the Torque class at runtime
directly from code?
Can we ask for the current DataSource somehow from Torque?
Thanks,
Andras.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: SharedPoolDataSourceFactory problem
Posted by Andras Balogh <an...@reea.net>.
Hello,
Sorry for the confusion created, problem solved.
Infact we have used Torque-3.1 and the problem was that the version of
dbcp was too old:
commons-dbcp-20030825.184428.jar
the correct one to use is commons-dbcp-1.2.1.jar
Best regards,
Andras.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
RE: SharedPoolDataSourceFactory problem
Posted by Greg Monroe <Gr...@DukeCE.com>.
Hmm, works fine for me with jTDS and MS SQL 7.0. I just
stopped and started my SQL development service (remote
machine from Tomcat development environment) and had no
problems. (I am using 3.2.1-dev but I don't think any
changes have been made in this area...)
The applicable settings in my Torque.properties are:
### MSSQL with jTDS
torque.database.default.adapter=mssql
torque.dsfactory.default.connection.driver =
net.sourceforge.jtds.jdbc.Driver
torque.dsfactory.default.connection.url =
jdbc:jtds:sqlserver://XX.dukece.com:1433/XX;TDS=7.0
torque.dsfactory.default.connection.user = XX
torque.dsfactory.default.connection.password =XX
# # Using commons-dbcp
torque.dsfactory.default.factory=
org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.default.pool.maxIdle=8
torque.dsfactory.default.pool.maxActive=10
torque.dsfactory.default.pool.testOnBorrow=true
torque.dsfactory.default.pool.validationQuery=SELECT 1
> Andras Balogh said:
>
> Hello Greg,
>
> We are using MS-SQL but the query is not the problem. This query
> "SELECT 1" is never called, is is not reaching the
> SQL Server (we see this with the Profiler started)
> What happens is that upon Torque.init these 2 properties:
>
> torque.dsfactory.bookstore.pool.testOnBorrow=true
> torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
>
> are not correctly passed to the underlying connection pool,
> in this case:
> org.apache.commons.dbcp.datasources.SharedPoolDataSource
>
> Can anybody confirm that he has successful validation and
> fail over in case of a DB restart
> with Torque3.2 with any DB? Strange is that with Torque 3.1
> it was working.
>
> So I'm looking for a workaround to somehow get my hands on
> the Datasource object
> (org.apache.commons.dbcp.datasources.SharedPoolDataSource)
> and set these properties
> by hand.
>
>
> Thanks for any help.
>
> Best regards,
> Andras
>
>
> Greg Monroe wrote:
> > What DB server are you using? It sounds like this server
> > simply does not support a "SELECT 1" query statement.
> > Try this from your DB isql, mysql, whatever script tool.
> >
> > If this is the case, then you'll need to figure out a
> > table-less query to replace the "SELECT 1" or a slightly
> > less efficient / generic, select from a table that will
> > return something (might need to be a 1).
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: SharedPoolDataSourceFactory problem
Posted by Andras Balogh <an...@reea.net>.
Hello Greg,
We are using MS-SQL but the query is not the problem. This query
"SELECT 1" is never called, is is not reaching the
SQL Server (we see this with the Profiler started)
What happens is that upon Torque.init these 2 properties:
torque.dsfactory.bookstore.pool.testOnBorrow=true
torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
are not correctly passed to the underlying connection pool, in this case:
org.apache.commons.dbcp.datasources.SharedPoolDataSource
Can anybody confirm that he has successful validation and fail over in case of a DB restart
with Torque3.2 with any DB? Strange is that with Torque 3.1 it was working.
So I'm looking for a workaround to somehow get my hands on the Datasource object
(org.apache.commons.dbcp.datasources.SharedPoolDataSource) and set these properties
by hand.
Thanks for any help.
Best regards,
Andras
Greg Monroe wrote:
> What DB server are you using? It sounds like this server
> simply does not support a "SELECT 1" query statement.
> Try this from your DB isql, mysql, whatever script tool.
>
> If this is the case, then you'll need to figure out a
> table-less query to replace the "SELECT 1" or a slightly
> less efficient / generic, select from a table that will
> return something (might need to be a 1).
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
RE: SharedPoolDataSourceFactory problem
Posted by Greg Monroe <Gr...@DukeCE.com>.
What DB server are you using? It sounds like this server
simply does not support a "SELECT 1" query statement.
Try this from your DB isql, mysql, whatever script tool.
If this is the case, then you'll need to figure out a
table-less query to replace the "SELECT 1" or a slightly
less efficient / generic, select from a table that will
return something (might need to be a 1).
> Andras Balogh said:
>
> Hello,
>
> We have developed a web application with Torque3-2.
> We have tested the scenario of stopping the DB server than
> restarting.
> The web application should "discover" that
> the Connections in the pool are broken, drop them and create new ones.
> For this we used these value torque.properties:
>
> torque.dsfactory.bookstore.pool.testOnBorrow=true
> torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
>
> As described here:
> http://db.apache.org/torque/releases/torque-3.2/runtime/refere
> nce/initialisation-configuration.html
>
> This is not working as expected, we see this in our log:
>
> Property: testOnBorrow value: true is not supported by DataSource:
> org.apache.commons.dbcp.datasources.SharedPoolDataSource
> Property: validationQuery value: SELECT 1 is not supported by
> DataSource: org.apache.commons.dbcp.datasources.SharedPoolDataSource
>
> I see the properties are passed to the apache dbcp datasource in this
> method:
> AbstractDataSourceFactory.setProperty but I don't know where
> should be
> the error, the error is catched but the stack trace is not
> provided olny
> an error
> in the log.
>
> So there is no way to tell Torque to check for connections in
> the pool
> and drop them if they are invalid.
> Can we set these properties somehow using the Torque class at runtime
> directly from code?
> Can we ask for the current DataSource somehow from Torque?
>
> Thanks,
> Andras.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org