You are missing the <Resource/> part (needs to be just above <ResourceParams/>
<Resource name="jdbc/conversion" auth="Container" scope="Sharable" type="javax.sql.DataSource"/> grts, Pat -----Original Message----- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:10 PM To: Tomcat Users List Subject: DB connection pool problem Hi, I am also having the problem with the connection pools. Since I am writing an application first time by using connection pools, I created a test application DBTest. I edited my server.xml and web.xml (of my application in following way-- #added to server.xml <Context path="/DBTest" docBase="DBTest" debug="0" reloadable="true"> <ResourceParams name="jdbc/conversion"> <parameter> <name>username</name> <value>ROOT</value> </parameter> <parameter> <name>password</name> <value>PASSWORD</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost/DB</value> </parameter> </ResourceParams> </Context> #web.xml <web-app> <description>MySQL Test App</description> <resource-ref> <res-ref-name>jdbc/conversion</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app> And I added the following statements to my Java class, (which works fine, when I use the connection objects by hardcoding the username and db).-- Context init = new InitialContext(); Context ctx = (Context) init.lookup("java:comp/env"); DataSource dataSource = (DataSource)ctx.lookup("jdbc/conversion"); But even after, making these changes, I cannot read any thing from database. I was wondering what more changes I need to made. I also tried to run my JAVA class (DAO) from command line, but I get the following exception-- Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial I tried to print outs the place where exception occurs in my code and found that exception occurs at dataSource = (DataSource)ctx.lookup("jdbc/conversion"); Can any body please comment on whats going on wrong? When I run from command line, is tomcat used, I don't think so? So where is the problem? Any ideas?? Avinash Arora --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
