db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Yu <Benjam...@InformativeResearch.com>
Subject RE: Torque on Tomcat: Exception: DataSourceFactory not configure d
Date Mon, 15 Mar 2004 23:41:56 GMT
Drake,

Here's my setup. The torque properties is to pull from a JNDI datasource...
These datasources are created by the servlet container.

# Torque.properties
# Torque config to pull the connections from a JNDI DataSource.
#  - The underlying JNDI DataSource may be pooled or unpooled.
#    The decission is left up to the deployment.
torque.database.default=foo
torque.dsfactory.foo.factory=org.apache.torque.dsfactory.JndiDataSourceFacto
ry
torque.dsfactory.foo.jndi.path=java:comp/env/jdbc/FooDB

I just noticed that your previous email's JNDI attempt contained a jdbc url
in the jndi.path... However, you need to specify a bound JNDI resource.
Tomcat has docs on doing this:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html


I personally advocate using the JNDI datasource factory method because it
decouples the runtime configuration from the "build time" of the webapp's
WAR file. This allows me to build one WAR file, deploy it in different
places and be able to talk to different databases. The disadvantage is that
you need a JNDI context provider, but that's ok since it's all under tomcat.

But I also use the following torque config to do some standalone testing
outside tomcat:

######################
# Torque Properties
#

# Set the default database
torque.database.default=foo

torque.database.foo.adapter=mssql

# commons-dbcp to manage the connection pool.
# Read the commons-dbcp docs for config.
torque.dsfactory.foo.factory=org.apache.torque.dsfactory.SharedPoolDataSourc
eFactory
torque.dsfactory.foo.pool.maxActive=10
torque.dsfactory.foo.pool.testOnBorrow=true
torque.dsfactory.foo.pool.validationQuery=SELECT 1
torque.dsfactory.foo.connection.driver=com.microsoft.jdbc.sqlserver.SQLServe
rDriver
torque.dsfactory.foo.connection.url=jdbc:microsoft:sqlserver://localhost:143
3;DatabaseName=FooDB;SelectMethod=cursor
torque.dsfactory.foo.connection.user=foodbuser
torque.dsfactory.foo.connection.password=foodbuser


-Ben


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


Mime
View raw message