VDS Sphera Knowledge Base

Main / Browse Categories / Tomcat Server / How do I connect to MySQL from a JSP page?

Print article Print Article    Email article Email Article

How do I connect to MySQL from a JSP page?

MySQL JDBC JSP Example on Sphera Tomcat

  1. Copy mysql-connector-java-3.0.8-stable-bin.jar to your /var/tomcat/common/lib Directory
  2. Restart Tomcat from the command line using ssh with:
    /etc/rc.d/init.d/apachectl restart
    
  3. Make sure that you have enabled remote access for your MySQL database. (This requires an IP address)
  4. Copy this code to a file named mysqljdbc.jsp in your /var/tomcat4/webapps/hw Directory. Be sure to replace IP_ADDRESS with your Database's External IP address. For this example you will need to add a table to your test database named "foo".
  5. Call your jsp page from within a web browser like: http://www.yourdomain.com/hd/mysqljdbc.jsp

User Comments
How do I connect to MySQL from a JSP page?  
There are no user comments for this topic.
 

Attachments

Related Articles
 How come my catalina.out file is zero length?
 Where do I put my JSP and servlet files?
 Where is my mod_jk.conf file?
 Where are my Tomcat logs located?
 What version of Tomcat will I have?

Why Choose Our Hosting?

  • Unmatched Customer Support!
  • Virtual Private Server technology provides a rich, dedicated-like environment for every account.
  • We are known for our superb quality, performance and flexible hosting environment. We manage the server, software, and network you do the rest.
Continue reading »

Featured Hosting Plan


Learn more about our VPS Extreme

What is Included?

  • PHP 5/MySQL 5
  • Parallels® Plesk Panel 10
  • Unique IP Address
  • Daily VPS Backups (Off Server)
  • SAS Hardware Raid diskspace
  • CentOS 5 x86_64 bit
  • Multi-homed Tier 1 Bandwidth
  • Full Upgrade capabilities
Continue reading »