This here should work. Follows a slightly different
approach: declare the datasource global to Tomcat and
let your application use a reference to it. In your
server.xml, this should be added:
(Example is for MySql)
The global DataSource definition
--------------------------------
<!-- Global JNDI resources -->
<GlobalNamingResources>
<Resource name="jdbc/MySQLConnectPool"
auth="Container"
type="javax.sql.DataSource" />
<ResourceParams name="jdbc/MySQLConnectPool" >
<parameter>
<name>username</name>
<value>????????</value>
</parameter>
<parameter>
<name>password</name>
<value>????????</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
etc....
<ResourceParams>
</GlobalNamingResources>
Context reference to global DataSource, this snippet
comes in the <context> part for your application and
is very important:
--------------------------------------
<ResourceLink name="jdbc/MySQLConnectPool"
global="jdbc/MySQLConnectPool"
type="javax.sql.DataSource" />
This should work. If the mysql.jar is in Tomcat's
/common/lib directory.
--- Paul Richards <[EMAIL PROTECTED]> wrote:
> Hi,
> I am running Tomcat from the Java Webservices
> Developer Pack 1.3 and I
> cannot get JNDI working for mysql DataSource
> objects. I have googled
> around for my error which is:
>
> java.sql.SQLException: Cannot load JDBC driver class
> 'null'
> at
>
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
> at
>
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)
>
>
> What I found on google was that this error is not
> just a problem with Mysql and that people have
> experienced it with Oracle and Postgresql also:
>
http://archives.real-time.com/pipermail/tomcat-users/2002-October/081368.html
>
> I tried the suggestion in this last URL of using the
> exact orderings of
> parameters in the server.xml file as shown in the
> Tomcat JNDI DataSource
> HowTo. Unfortunately this has not helped my case.
>
>
> I appreciate that a very similar thread to this is
> currently running but
> that problem looks different to mine.
>
>
> I have failover code which created a Mysql
> datasource manually if the
> JNDI fails and the failover code works perfectly.
> This makes me sure
> that my CLASSPATHs are correct.
>
>
>
> --
> Paul Richards <[EMAIL PROTECTED]>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]