Please see in text my answer.

ge wrote:
> <sql:query var="rs"
> dataSource="jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude">
>  select id, foo, bar from testdata </sql:query>

I think you want to use the name of the dataSourced, here, not the URL.
You want something like "jdbc/MyDataSource" -- it should match whatever
you have in your server.xml (or context.xml) to configure the
datasource's name.

- -chris

When I use 
<sql:query var="rs" dataSource="jdbc/TestDB">
I get:
javax.servlet.ServletException: Unable to get connection, DataSource invalid: 
"java.sql.SQLException: No suitable driver found for jdbc/TestDB"

my  server.xml loks:
-----------------------
<!-- Server Configuration File for Tomcat 5 on Debian
     You can find a more complete example in /usr/share/doc/tomcat5/examples/
 -->

<!-- Note that component elements are nested corresponding to their
     parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
     which may contain one or more "Service" instances.  The Server
     listens for a shutdown command on the indicated port.

     Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" or "Loggers" at this level.
 -->

<Server port="8005" shutdown="SHUTDOWN" debug="0">

  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" (and therefore the web applications visible
       within that Container).  Normally, that Container is an "Engine",
       but this is not required.

       Note:  A "Service" is not itself a "Container", so you may not
       define subcomponents such as "Valves" or "Loggers" at this level.
   -->

  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Tomcat-Standalone">

    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned.  Each Connector passes requests on to the
         associated "Container" (normally an Engine) for processing.
    -->

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8180 -->
    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
               port="8180" minProcessors="5" maxProcessors="75"
               enableLookups="true" acceptCount="10" debug="0"
               connectionTimeout="20000" useURIValidationHack="false" />

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" acceptCount="10" debug="0"
               connectionTimeout="20000" useURIValidationHack="false"
               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host). -->

    <!-- Define the top level container in our container hierarchy 
         The name must be Catalina for correct function of the admin webapp -->
    <Engine name="Catalina" defaultHost="localhost" debug="0">

      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_" suffix=".log" timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             debug="0" resourceName="UserDatabase"/>

      <!-- Define the default virtual host -->
      <Host name="localhost" debug="0" appBase="webapps" 
            unpackWARs="true" autoDeploy="true">

        <!-- Logger shared by all Contexts related to this virtual host. -->
        <Logger className="org.apache.catalina.logger.FileLogger"
                directory="logs" prefix="localhost_" suffix=".log"
                timestamp="true"/>       

        <Context path="/jli/Q2_JSPs"
                 docBase="/home/en/public_html/jsp/Beispiele"
                 reloadable="true" />
        
        <Context path="/jli/Q3_JSPs"
                 docBase="/home/en/public_html/jsp/Kapitel_4/Beispiele"
                 reloadable="true" />
        
        <Context path="/jli/Q4_JSPs"
                 docBase="/home/en/public_html/jsp/Kapitel_5/Beispiele"
                 reloadable="true" />
        
        <Context path="/jli/DB"
                 docBase="/home/en/public_html/jsp/DB"
                 reloadable="true" />
        
        <Context path="/ajax/k2"
                 docBase="/home/en/public_html/jsp/ajax/Beispiele/kap2"
                 reloadable="true" />
        
        <Context path="/DBTest" docBase="DBTest"
                 debug="5" reloadable="true" crossContext="true">
                
                <Logger className="org.apache.catalina.logger.FileLogger"
                        prefix="localhost_DBTest_log." suffix=".txt"
                        timestamp="true"/>
                
                <Resource name="jdbc/TestDB"
                          auth="Container"
                          type="javax.sql.DataSource"/>
                
                <ResourceParams name="jdbc/TestDB">
                        <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 -1 for no limit.  See also the DBCP 
documentation on this
                             and the minEvictableIdleTimeMillis configuration 
parameter.
                             -->
                        <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>javauser</value>
                        </parameter>
                        <parameter>
                                <name>password</name>
                                <value>javadude</value>
                        </parameter>
                        
                        <!-- Class name for the old mm.mysql JDBC driver - 
uncomment this entry and comment next
                             if you want to use this driver - we recommend 
using Connector/J though
                             <parameter>
                                     <name>driverClassName</name>
                                     <value>org.gjt.mm.mysql.Driver</value>
                             </parameter>
                             -->
                             
                             <!-- Class name for the official MySQL Connector/J 
driver -->
                             <parameter>
                                     <name>driverClassName</name>
                                     <value>com.mysql.jdbc.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/javatest?autoReconnect=true</value>
                             </parameter>
                     </ResourceParams>
             </Context>
             
             
        
      </Host>

    </Engine>

  </Service>


</Server>
----------



-
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to