struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "rainer juenger" <>
Subject Re: DataSource problem
Date Fri, 14 Jun 2002 14:07:20 GMT
Hi Maarten,

join the club! There are some more guys having exactliy the same problem as
To me your configuration looks all right. I saw some samples :

<parameter>      <name>driverName</name>
<value>jdbc:mysql://localhost/test</value> </parameter>

where the parameter name is not driverName but url. I tried both without

Are you using Tomcat 4.x without DBCP from the Jakarta Commons to get the
JNDI DB Connection?

Please follow the thread "Connection pooling dowsn't work for me ... Help
Hopefully there is someone arround giving us a tip how to get it run

Good luck to all of us ;)

----- Original Message -----
From: "Maarten Roosendaal" <>
To: <>
Sent: Friday, June 14, 2002 3:42 PM
Subject: DataSource problem


I'm trying to create a simple DataBase app. using Struts. Right now i have a
problem with getting the DataSource out of the InitialContext and i'm not
sure what i'm doing wrong or maybe it has something to do with the Struts

In configured the server.xml as follows:
 <Resource name="test" auth="CONTAINER"

 <ResourceParams name="test">
       <parameter>      <name>user</name>
<value>root</value>                                  </parameter>
       <parameter>      <name>password</name>            <value></value>
       <parameter>      <name>driverClassName</name>
<value></value>     </parameter>
       <parameter>      <name>driverName</name>
<value>jdbc:mysql://localhost/test</value> </parameter>

and my web.xml includes the following:

In an Action-class i do this:
        Context env = (Context) new
        DataSource ds = (DataSource) env.lookup("test");
Here the DataSource keeps ending up as NULL. When i do this:
    Connection con = DriverManager.getConnection(Commands.DB_TEST_URL,
Commands.DB_TEST_USERNAME, "");
    things are working fine but i have no idea where to look. The Context
does seem to have a reference to the 'test' reference but nothing more.
Does this have something to do with Struts or did i forget something? I
don't want to use the struts.xml for a database-connection. One of the
reasons is that i keep getting the message that it can't find the driver,
while it is included in the CLASSPATH.

Hope someone can help,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message