db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Drake Philbrook" <...@graphtek.com>
Subject RE: Torque on Tomcat: Exception: DataSourceFactory not configured
Date Tue, 16 Mar 2004 02:39:47 GMT
I resolved the problem by upgrading to Tomcat V4.1.  It seems V4.0.x
doesn't support commons-dbcp.

Drake 

-----Original Message-----
From: Benjamin Yu [mailto:BenjaminY@InformativeResearch.com] 
Sent: Monday, March 15, 2004 3:42 PM
To: 'Apache Torque Users List'
Subject: RE: Torque on Tomcat: Exception: DataSourceFactory not
configured 

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.JndiDataSourceF
acto
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.SharedPoolDataS
ourc
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.SQLS
erve
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



---------------------------------------------------------------------
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