You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marcus Blackhall <mb...@planet.nl> on 2001/12/16 19:48:23 UTC
using MySQL as a datasource
Hi All,
I am attempting to use MySQL as a datasouce for struts to make use of the Connection Pool. I have in my struts-config.xml file the floowing for the datasource
<data-sources>
<data-source>
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="Example Data Source Configuration"/>
<set-property property="driverClass"
value="org.gjt.mm.mysql.Driver"/>
<set-property property="maxCount"
value="4"/>
<set-property property="minCount"
value="2"/>
<set-property property="password"
value="some_pass"/>
<set-property property="url"
value="jdbc:mysql://localhost:3306/myjsp"/>
<set-property property="user"
value="monty"/>
</data-source>
</data-sources>
I have placed the Jars jdbc2_0-stdext.jar, struts.jar and the reuired MySQL driver jar (mysql_comp.jar) in the WEB-INF/lib directory for my application.
Within the web.xml file for my application the servlet action is defined as follows :
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>org.apache.struts.webapp.example.ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
The problem is that whenever I have the datasource my application will not run because the action servlet fails on initialisation with the following error :
cannot load servlet name: action: Exception initializing application data source
org.apache.struts.action.DATA_SOURCE
Has anybody got any ideas on this. I have tested within my IDE that the database can be connected with the above url and user/password connections. Do I need any more configurations in web.xml or struts-config.xml ?
any answers would be much appreciated,
thanks in advance
Marcus
Re: using MySQL as a datasource
Posted by Marcus Blackhall <mb...@planet.nl>.
Thanks for the reply,
it turned out that the property auto-commit must be set to true and not
false. I changed the line
<set-property property="autoCommit" value="false"/> to <set-property
property="autoCommit" value="true"/>
and all went well,
Marcus
----- Original Message -----
From: "Peter Kordel" <pk...@zvolve.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, December 17, 2001 9:17 PM
Subject: Re: using MySQL as a datasource
> Try these things first:
> Verify that you have the latest stable version of mysql - 3.23.46 I
> think.
> Get the latest driver - 2.0.8
> I ran into an issue with a third-party connection pool that passed
> transaction-level parameters to a pre-3.23.36 mysql server, causing
> *pages* of StackOverflows.
>
> Finally, may I suggest looking into Poolman as an alternative to the
> struts connection pooling.
>
> Marcus Blackhall wrote:
> >
> > Hi All,
> > I am attempting to use MySQL as a datasouce for struts to make use of
the Connection Pool. I have in my struts-config.xml file the floowing for
the datasource
> >
> > <data-sources>
> > <data-source>
> > <set-property property="autoCommit"
> > value="false"/>
> > <set-property property="description"
> > value="Example Data Source Configuration"/>
> > <set-property property="driverClass"
> > value="org.gjt.mm.mysql.Driver"/>
> > <set-property property="maxCount"
> > value="4"/>
> > <set-property property="minCount"
> > value="2"/>
> > <set-property property="password"
> > value="some_pass"/>
> > <set-property property="url"
> > value="jdbc:mysql://localhost:3306/myjsp"/>
> > <set-property property="user"
> > value="monty"/>
> > </data-source>
> > </data-sources>
> >
> > I have placed the Jars jdbc2_0-stdext.jar, struts.jar and the reuired
MySQL driver jar (mysql_comp.jar) in the WEB-INF/lib directory for my
application.
> >
> > Within the web.xml file for my application the servlet action is defined
as follows :
> >
> > <servlet>
> > <servlet-name>action</servlet-name>
> >
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> > <init-param>
> > <param-name>application</param-name>
> >
<param-value>org.apache.struts.webapp.example.ApplicationResources</param-va
lue>
> > </init-param>
> > <init-param>
> > <param-name>config</param-name>
> > <param-value>/WEB-INF/struts-config.xml</param-value>
> > </init-param>
> > <init-param>
> > <param-name>debug</param-name>
> > <param-value>2</param-value>
> > </init-param>
> > <init-param>
> > <param-name>detail</param-name>
> > <param-value>2</param-value>
> > </init-param>
> > <init-param>
> > <param-name>validate</param-name>
> > <param-value>true</param-value>
> > </init-param>
> > <load-on-startup>2</load-on-startup>
> > </servlet>
> > <servlet-mapping>
> > <servlet-name>action</servlet-name>
> > <url-pattern>*.do</url-pattern>
> > </servlet-mapping>
> >
> > The problem is that whenever I have the datasource my application will
not run because the action servlet fails on initialisation with the
following error :
> >
> > cannot load servlet name: action: Exception initializing application
data source
> > org.apache.struts.action.DATA_SOURCE
> >
> > Has anybody got any ideas on this. I have tested within my IDE that the
database can be connected with the above url and user/password connections.
Do I need any more configurations in web.xml or struts-config.xml ?
> >
> > any answers would be much appreciated,
> > thanks in advance
> > Marcus
>
> --
> Peter Kordel
> Software Engineer
> Zvolve Systems, Inc.
> 770-551-4528
> http://www.zvolve.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: using MySQL as a datasource
Posted by Peter Kordel <pk...@zvolve.com>.
Try these things first:
Verify that you have the latest stable version of mysql - 3.23.46 I
think.
Get the latest driver - 2.0.8
I ran into an issue with a third-party connection pool that passed
transaction-level parameters to a pre-3.23.36 mysql server, causing
*pages* of StackOverflows.
Finally, may I suggest looking into Poolman as an alternative to the
struts connection pooling.
Marcus Blackhall wrote:
>
> Hi All,
> I am attempting to use MySQL as a datasouce for struts to make use of the Connection Pool. I have in my struts-config.xml file the floowing for the datasource
>
> <data-sources>
> <data-source>
> <set-property property="autoCommit"
> value="false"/>
> <set-property property="description"
> value="Example Data Source Configuration"/>
> <set-property property="driverClass"
> value="org.gjt.mm.mysql.Driver"/>
> <set-property property="maxCount"
> value="4"/>
> <set-property property="minCount"
> value="2"/>
> <set-property property="password"
> value="some_pass"/>
> <set-property property="url"
> value="jdbc:mysql://localhost:3306/myjsp"/>
> <set-property property="user"
> value="monty"/>
> </data-source>
> </data-sources>
>
> I have placed the Jars jdbc2_0-stdext.jar, struts.jar and the reuired MySQL driver jar (mysql_comp.jar) in the WEB-INF/lib directory for my application.
>
> Within the web.xml file for my application the servlet action is defined as follows :
>
> <servlet>
> <servlet-name>action</servlet-name>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
> <param-name>application</param-name>
> <param-value>org.apache.struts.webapp.example.ApplicationResources</param-value>
> </init-param>
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>debug</param-name>
> <param-value>2</param-value>
> </init-param>
> <init-param>
> <param-name>detail</param-name>
> <param-value>2</param-value>
> </init-param>
> <init-param>
> <param-name>validate</param-name>
> <param-value>true</param-value>
> </init-param>
> <load-on-startup>2</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>action</servlet-name>
> <url-pattern>*.do</url-pattern>
> </servlet-mapping>
>
> The problem is that whenever I have the datasource my application will not run because the action servlet fails on initialisation with the following error :
>
> cannot load servlet name: action: Exception initializing application data source
> org.apache.struts.action.DATA_SOURCE
>
> Has anybody got any ideas on this. I have tested within my IDE that the database can be connected with the above url and user/password connections. Do I need any more configurations in web.xml or struts-config.xml ?
>
> any answers would be much appreciated,
> thanks in advance
> Marcus
--
Peter Kordel
Software Engineer
Zvolve Systems, Inc.
770-551-4528
http://www.zvolve.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>