Conclusion & Resources
We have created an application that demonstrates how Apache Tomcat and
MySQL can communicate with one another, and have given you a very
useful and reusable tool that handles most of the database work for
you. There are several things you could do to expand this application
that are outside the scope of this article. As we described above, you
could expand the application into a system in which you charge
customers for a certain number of clicks or even a certain number of
impressions. The CustomerName
field in the database could easily be replaced by some other field that
would be a primary key in another table containing all of your customer
information.
You could expand the DBHandler
class to handle
database connection pooling. In addition, you could externalize the
queries you want to use for your application into a text, properties,
or XML file, allowing you to expand or change query definitions without
having to write more code.
- Download the source code used in this article.
- The Jakarta Project is Tomcat's parent project and hosts many other fabulous open source projects that you can use.
- The MySQL Web page has links on how to download and use mySQL.
- Download the MM MySql JDBC Driver used in this article from Sourceforge.
- The JDBC API documentation is a great resource for anything involving JDBC.
- Learn more about JDBC with these free developerWorks tutorials: Managing database connections with JDBC (November 2001) and Advanced database operations with JDBC (November 2001).
- Another good JDBC resource is the JDBC 2.0 Fundamentals short course from the Java Developer Connection.
- The Tomcat Book
was founded in April 2001 to come up with an open-source guide to
installing, configuring, and deploying the Tomcat JSP/Servlet server
and applications for it.
- If you have specific questions about Tomcat, The JGuru Tomcat FAQ is an interactive FAQ where you can post your questions.
- In "Filtering tricks for your Tomcat" (developerWorks, June 2001), Sing Li shows you how to make productive use of filters in your projects.
- JavaServer
Pages (JSP) technology is typically used for building HTML pages with
dynamic content. But you can use this technology to generate dynamic
content in other formats as well, including XML. Marshall Lamb shows
you how in "Generate dynamic XML with JavaServer Pages technology" (developerWorks, December 2000).
- Find more resources on the developerWorks Java technology zone.
View Generate dynamic content with Tomcat and MySQL Discussion
Page: 1 2 3 4 5 Next Page: Create your own Java-based rotating banner advertisements