Re: Tomcat Datasource , can we define them in war file (whithout accessing to Admin console)?

2006-01-03 Thread Bruce Tong
On 12/26/05, Legolas Woodland [EMAIL PROTECTED] wrote:

 Is it possible to make a data-source without admin console ?
 I mean by defining the data-source in web.xml or in Context.xml (i think
 i read somewhere that we could put context.xml into meta-inf folder and
 it will act like Context definition in admin console).


Yes, you can define your datasource in the application's
META-INF/context.xml file. There are examples on the web, but I can provide
an example if you contact me directly. I'd post a link but I'm writing this
in a hurry.

is it mandatory that Tomcat shared library folder contain my database
 jdbc driver to have data-source ?
 I mean can we bundle , our JDBC driver inside war file and define the
 data-source in war file too ?


I've not tried that but have assumed it's possible.

--

Bruce Tong


Re: JDBC Resources, context file, Tomcat 5.0.x - 5.5.x

2005-12-19 Thread Bruce Tong
Here's an example that's working for me.

Context path=/dars docBase=dars debug=1 reloadable=true
crossContext=true

Resource
name=jdbc/THEDB
auth=Container
type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@AAA.BBB.CCC.DDD::
username=
password=
maxActive=20
maxIdle=1
maxWait=15000
removeAbandoned=true
logAbandoned=true
removeAbandonedTimeout=300
testOnBorrow=true
testOnReturn=true
validationQuery=select 1 from dual
/

/Context



On 12/19/05, Diego Ballve [EMAIL PROTECTED] wrote:

 Hello,

 I'm trying to migrate a context descriptor for a webapp named omar, from
 Tomcat 5.0.x to 5.5.x but I had no luck. This is my new
 tomcat/conf/Catalina/localhost/omar.xml:

 Context path=/omar debug=5
   Resource name=omar-registry auth=Container scope=Shareable
 type=javax.sql.DataSource
 url=jdbc:hsqldb:/home/diego/omar/3.0-beta1/data/registry/omar
 driverClassName=org.hsqldb.jdbcDriver
 username=sa password=
 maxWait=3000 maxIdle=100 maxActive=50
 removeAbandoned=true removeAbandonedTimeout=60
 logAbandoned=true/
 /Context

 When I try to start the server i get the following in catalina.out:
 Cannot create JDBC driver of class '' for connect URL 'null'
 at
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(
 BasicDataSource.java:780)
 ...
 which I believe indicates that my resource params were ignored
 (considering: class '').

 I've tried versions 5.5.9 and 5.5.14-beta. I'm sure the file gets
 digested (I had invalid docBase before and I could see the message) and
 I'm also sure the jdbc driver jar is in common/lib.

 Has anybody succeeded with defining jdbc resource in a context file? Can
 anybody spot what I am doing wrong? Do you have any hints on how/what to
 debug to find out what's wrong?

 Thanks,
 Diego


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




--

Bruce Tong