I am not able to set up datasource for connection pooling , i am using
tomcat 4.1.3, and connection to mysql database..
following is the code to retrieve the datasource...


============================================================================
===========
                        Context ctx = new InitialContext();
                        Context env = (Context)ctx.lookup("java:comp/env");
                        DataSource ds = (DataSource) env.lookup("jdbc/prototypedb");
                        conn = ds.getConnection();

================================entry in server .xml

 <!-- JNDI datasource setup to connect to MYSQL database-->
        <Context path="/PrototypeDBTest" docBase="PrototypeDBTest"
                debug="5" reloadable="true" crossContext="true" useNaming="true">

        <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_PrototypeDBTest_log." suffix=".txt"
             timestamp="true"/>
             <Resource name="jdbc/prototypedb"
               auth="Container"
               type="javax.sql.DataSource"/>

        <ResourceParams name="jdbc/prototypedb">
        <parameter>
          <name>factory</name>
          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>

        <!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->
        <parameter>
          <name>maxActive</name>
          <value>100</value>
        </parameter>

        <!-- Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.
         -->
        <parameter>
         <name>maxIdle</name>
         <value>30</value>
        </parameter>

         <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->
        <parameter>
         <name>maxWait</name>
         <value>10000</value>
        </parameter>

        <!-- MySQL dB username and password for dB connections  -->
        <parameter>
          <name>username</name>
          <value>antonio</value>
        </parameter>
        <parameter>
          <name>password</name>
          <value>play</value>
        </parameter>

        <!-- Class name for mm.mysql JDBC driver -->
        <parameter>
          <name>driverClassName</name>
          <value>org.gjt.mm.mysql.Driver</value>
        </parameter>

        <!-- The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed
the
         connection.  mysqld by default closes idle connections after 8
hours.
         -->
        <parameter>
        <name>url</name>

<value>jdbc:mysql://localhost:3306/prototypedb?autoReconnect=true</value>
        </parameter>
</ResourceParams>
</Context>


<!-- End of JNDI datasource setup -->
===========================================================

below is my web.xml......

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd";>

<web-app>
<description>PrototypeDB Test App</description>
 <resource-ref>
 <description>DB Connection</description>
<res-ref-name>jdbc/prototypedb</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
 </resource-ref>
 </web-app>


Please help: i have added the entry in server.xml between  context for
example... an d host variable.



-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 27, 2004 9:06 AM
To: Tomcat Users List; [EMAIL PROTECTED]
Subject: RE: Validating Users



Hi,
Yup, you should be able to get to the admin app using the "richard"
user.  The file is case-sensitive, and you have to restart the server
after you edit it (with the default configuration).

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Richard Crawford [mailto:[EMAIL PROTECTED]
>Sent: Monday, July 26, 2004 5:41 PM
>To: [EMAIL PROTECTED]
>Subject: Validating Users
>
>I have just installed Tomcat 5.0.27 on a Solaris 9 computer.  I've got
>it pointed at the right installation of Java, and when I go to
>http://localhost:8080 I see the Tomcat startup page come up, so I
assume
>Tomcat is up and running properly.
>
>However, when I try to access the Tomcat Administration or Tomcat
>Manager pages, I get an "invalid user" error.  However, when I examine
>conf/tomcat-users.xml, I find that I am listed as an admin user:
>
><tomcat-users>
>  <role rolename="standard"/>
>  <role rolename="manager"/>
>  <role rolename="admin"/>
>  <user username="richard" password="password"
>roles="admin,standard,manager"/>
></tomcat-users>
>
>So, I *should* be able to get to the administration and management
>pages, right?
>
>I feel that I am missing something VERY basic...
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


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

Reply via email to