You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Benjamin Slade <be...@benslade.com> on 2005/11/10 05:14:03 UTC

Pointers on setting up Tomcat 5.5x w/MySQL on OS X?

Can someone point me to some resources for setting up Tomcat so that 
servlets/JSP's can connect to a local MySQL database?

The instructions for configuring Connector/J (at 
dev.mysql.com/doc/refman/5.0/en/cj-tomcat-config.html ) don't seem to 
match the setup of my tomcat/conf/server.xml file.    Specifically, the 
Connector/J web page talks about adding:

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

Inside the <Context> tag of the conf/server.xml file, but there is no 
<Context> tag in my conf/server.xml.   Should I add one?  Or should I 
add these XML tags to the tomcat/conf/context.xml?   Where can I find 
documentation on the structure of the server.xml and context.xml 
files?   The Apache Tomcat Configuration Reference web page doesn't have 
much and neither does the Database question in the Tomcat FAQ.  I've 
searched the tomcat.apache.org archives, but I haven't found anything 
which talks directly about this (maybe I'm just not using the right 
search terms)

The Apache Tomcat Configuration Reference: The Context Container web 
page (tomcat.apache.org/tomcat-5.5-doc/config/context.html ) seems to 
have lots of information, but it seems like a lot of reference detail.  
I just need a database "Hello World" example.

I'm a newbie so I'm not familiar with the structure/semantics of the 
server.xml and context.xml files.   Also, I haven't gotten around to 
learning how JNDI works.   I was sort of hoping to do a "Hello World" 
database JSP before delving into all of the system guts.  But if I have 
to, where can I find reference documentation for the various config 
files for Tomcat?

Thanks
Ben Slade

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers on setting up Tomcat 5.5x w/MySQL on OS X?

Posted by Benjamin Slade <be...@benslade.com>.
After much gnashing of teeth I figured out that I wanted to add database 
connection "resource" information inside a <context> element in a 
META-INF/context.xml file under the web application directory.    Yes 
there are other ways to do it, but this seems like a good mainstream style.

It's too bad the MySQL Connector/J and Tomcat web page ( 
http://dev.mysql.com/doc/refman/5.0/en/cj-tomcat-config.html ) wasn't 
more newbie friendly.

You can see my detailed tutorial/writeup at:

  
http://www.benslade.com/projects/java/tomcat/InstallingJavaTomcatMySQLOnMacOSX/

All feedback/corrections on the above web page are appreciated.

Ben Slade


Benjamin Slade wrote:
> Can someone point me to some resources for setting up Tomcat so that 
> servlets/JSP's can connect to a local MySQL database?
>
> The instructions for configuring Connector/J (at 
> dev.mysql.com/doc/refman/5.0/en/cj-tomcat-config.html ) don't seem to 
> match the setup of my tomcat/conf/server.xml file.    ...snip...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers on setting up Tomcat 5.5x w/MySQL on OS X?

Posted by Len Popp <le...@gmail.com>.
The official docs are at http://tomcat.apache.org/tomcat-5.5-doc (as
you've already found). I found those docs hard to understand when I
was starting from scratch. Try going through the Setup and First Web
App sections, and then the JDBC config page that I linked before.

There might be a better tutorial somewhere for setting up Tomcat 5.5
and MySQL, but unfortunately I don't have a pointer to one.
--
Len

On 11/10/05, Benjamin Slade <be...@benslade.com> wrote:
> Thanks for the info, but one more question..   Where can I find
> documentation on this sort of thing?
>
> Ben Slade
>
> Len Popp wrote:
> > server.xml is the old location for the <Context> but these days it's
> > usually found either in conf/Catalina/[hostname]/[appname].xml or in
> > webapps/[appname]/META-INF/context.xml.
> >
> > Also note that the syntax of <Resource> has changed in 5.5. See
> > http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> > --
> > Len
> >
> > On 11/9/05, Benjamin Slade <be...@benslade.com> wrote:
> >
> >> Can someone point me to some resources for setting up Tomcat so that
> >> servlets/JSP's can connect to a local MySQL database?
> >>
> >> ...snip...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers on setting up Tomcat 5.5x w/MySQL on OS X?

Posted by Benjamin Slade <be...@benslade.com>.
Thanks for the info, but one more question..   Where can I find 
documentation on this sort of thing?

Ben Slade

Len Popp wrote:
> server.xml is the old location for the <Context> but these days it's
> usually found either in conf/Catalina/[hostname]/[appname].xml or in
> webapps/[appname]/META-INF/context.xml.
>
> Also note that the syntax of <Resource> has changed in 5.5. See
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> --
> Len
>
> On 11/9/05, Benjamin Slade <be...@benslade.com> wrote:
>   
>> Can someone point me to some resources for setting up Tomcat so that
>> servlets/JSP's can connect to a local MySQL database?
>>
>> ...snip...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers on setting up Tomcat 5.5x w/MySQL on OS X?

Posted by Len Popp <le...@gmail.com>.
server.xml is the old location for the <Context> but these days it's
usually found either in conf/Catalina/[hostname]/[appname].xml or in
webapps/[appname]/META-INF/context.xml.

Also note that the syntax of <Resource> has changed in 5.5. See
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
--
Len

On 11/9/05, Benjamin Slade <be...@benslade.com> wrote:
> Can someone point me to some resources for setting up Tomcat so that
> servlets/JSP's can connect to a local MySQL database?
>
> The instructions for configuring Connector/J (at
> dev.mysql.com/doc/refman/5.0/en/cj-tomcat-config.html ) don't seem to
> match the setup of my tomcat/conf/server.xml file.    Specifically, the
> Connector/J web page talks about adding:
>
> <Resource name="jdbc/MySQLDB"
>                auth="Container"
>                type="javax.sql.DataSource"/>
>
> Inside the <Context> tag of the conf/server.xml file, but there is no
> <Context> tag in my conf/server.xml.   Should I add one?  Or should I
> add these XML tags to the tomcat/conf/context.xml?   Where can I find
> documentation on the structure of the server.xml and context.xml
> files?   The Apache Tomcat Configuration Reference web page doesn't have
> much and neither does the Database question in the Tomcat FAQ.  I've
> searched the tomcat.apache.org archives, but I haven't found anything
> which talks directly about this (maybe I'm just not using the right
> search terms)
>
> The Apache Tomcat Configuration Reference: The Context Container web
> page (tomcat.apache.org/tomcat-5.5-doc/config/context.html ) seems to
> have lots of information, but it seems like a lot of reference detail.
> I just need a database "Hello World" example.
>
> I'm a newbie so I'm not familiar with the structure/semantics of the
> server.xml and context.xml files.   Also, I haven't gotten around to
> learning how JNDI works.   I was sort of hoping to do a "Hello World"
> database JSP before delving into all of the system guts.  But if I have
> to, where can I find reference documentation for the various config
> files for Tomcat?
>
> Thanks
> Ben Slade

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org