Hi again.

I just solved my problem with global datasources in Tomcat.
Instead of putting my <Resource name=....> and <ResourceParams....> in
<GlobalNamingResources></GlobalNamingResources> (which gave me lot's of
trouble and exceptions) I put it in the <DefaultContext></DefaultContext>
and removed <resource-ref> from my web.xml.

I don't know if this is a neat solution but hey, it works. :-)

/Fredrik

-----Ursprungligt meddelande-----
Från: Fredrik Larsson [mailto:[EMAIL PROTECTED]
Skickat: den 11 mars 2003 14:39
Till: [EMAIL PROTECTED]
Ämne: Global DataSource


Hi all.

I'm trying to set up a global DataSource on my Tomcat 4.1.18 standalone to
be available to all of my applications installed on the server.

But... I just can't get this to work. I've been following the instructions
in the tomcat documentation but it doesn't help.

I can start the server without any problems and view the global datasource
in the Administration Tool but as soon as I'm trying to access the
datasource from a servlet i get the following exception:
java.sql.SQLException: Cannot load JDBC driver class 'null'.

I've tried to set up the datasource for just one application context and
that works... but that's not what I want.

Another thing is that when I'm trying to view the datasources for one
specific application-context that should use this global datasource I get
this exception:
org.apache.jasper.JasperException: Exception retrieving attribute
'driverClassName'

Has anyone got a clue?

Thanks!
/Fredrik


This is what my conf-files look like:

SERVER.XML
  <GlobalNamingResources>

    <Resource   name="jdbc/MyDB"
                auth="Container"
                type="javax.sql.DataSource"/>

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

        <parameter>
            <name>maxActive</name>
            <value>100</value>
        </parameter>

        <parameter>
            <name>maxIdle</name>
            <value>30</value>
        </parameter>

        <parameter>
            <name>maxWait</name>
            <value>10000</value>
        </parameter>

        <parameter>
            <name>username</name>
            <value>myusername</value>
        </parameter>
        <parameter>
            <name>password</name>
            <value></value>
        </parameter>

        <parameter>
            <name>driverClassName</name>
            <value>org.gjt.mm.mysql.Driver</value>
        </parameter>

        <parameter>
            <name>url</name>
            <value>jdbc:mysql://localhost:3306/mydb</value>
        </parameter>
    </ResourceParams>

  </GlobalNamingResources>

WEB.XML
    <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/MyDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>


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