tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@shareowner.com
Subject RE: How To Unit Testing Tomcat Datasource
Date Wed, 19 Feb 2003 18:14:17 GMT
Always use java:comp/env/yourdatasource

Regards,
 
 
PQ
 
"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-----Original Message-----
From: Haytham Samad [mailto:haytham@speakeasy.net] 
Sent: February 19, 2003 1:13 PM
To: Tomcat Users List
Subject: How To Unit Testing Tomcat Datasource

I have set up a datasource in Tomcat's server.xml using dbcp.  It works
fine, I get connections connect to the database, etc.  Now, I am in the
process of putting together quite a bit of DAO code and would like to unit
test each call as I am going through the coding using my JUnit tests.  How
can I connect to Tomcat's JNDI and get a reference to the datasource there
to pass to the classes I am testing?  Or should I just rework my test code
to just create a connection from the DriverManager and go from there?
Anybody doing anything like this with suggestions?  I appreciate any
help....

BTW:  I tried to connect to Tomcat's JDNI using the InitialContext and that
did not work because I could not get a datasource.

Peace,


Haytham


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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message