You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nick Torenvliet <ni...@fieldstonesolutions.com> on 2003/01/07 04:46:26 UTC
linking a struts application to a jndi resource through a
datasource
Hi, So I've got two pieces, on one side a working mysql struts data
source example, on the other side a working tomcat 4.1 servlet.xml
configured jndi resource linked to a mysql data base. I want to access
the jndi from inside of struts, can I configure a data source to link to
the jndi resource, if so should I be including any special name or key
parameters in the datasource, or give it a special type?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: linking a struts application to a jndi resource through a
datasource
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On 6 Jan 2003, Nick Torenvliet wrote:
> Date: 06 Jan 2003 22:46:26 -0500
> From: Nick Torenvliet <ni...@fieldstonesolutions.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>,
> nick@fieldstonesolutions.com
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: linking a struts application to a jndi resource through a
> datasource
>
> Hi, So I've got two pieces, on one side a working mysql struts data
> source example, on the other side a working tomcat 4.1 servlet.xml
> configured jndi resource linked to a mysql data base. I want to access
> the jndi from inside of struts, can I configure a data source to link to
> the jndi resource, if so should I be including any special name or key
> parameters in the datasource, or give it a special type?
>
If you want to use JNDI-based data sources, you don't need *anything* in
struts-config.xml, and you would use the standard JNDI programming logic
to utilize it. See the following docs for more info:
http://jakarta.apache.org/tomcat-4.1-doc/jndi-resources-howto.html
http://jakarta.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html
Although the mechanism for configuring a JNDI data source in your
container is container-specific, the setup of your web.xml file (i.e. a
<resource-ref> element) and the code to access it (getting the
InitialContext and so on) is portable.
Use *either* the Struts <data-source> *or* JNDI. Not both.
Craig
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>