[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now



Posted on 2004-01-20
Medium Priority
Last Modified: 2010-04-01
I would like to learn to develop web-based apps using JSP and MySQL.  I am somewhat comfortable working in ASP and Access.  Do you guys recommend any tutorials for both JSP/MySQL.  Any other suggestions in decreasing my learning curve.  I know a bit of Java already.


Question by:iptrader
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 15

Assisted Solution

jimmack earned 1000 total points
ID: 10158216
Handling a request to a MySQL database from JSP is quite easy.  Here's a quick example:

<%@page import="java.util.*,java.sql.*" %>
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/testdatabase",
                                                                              "username", "password");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * FROM table1");
    while (rs.next())  // the cursor starts before the first record, so you need to move it.  This also checks that a record is present.
        // Do something with each row.
LVL 15

Accepted Solution

jimmack earned 1000 total points
ID: 10158282
This relies on the jar file containing the MySQL driver to be available to Tomcat.

In this case, I'm using mysql-connector-java-2.0.14-bin.jar and I need it in several web apps on my server, so I've put it in:

<tomcat home>/common/lib

If you only want it for your web app, you could place the jar file in:

<tomcat home/webapps/<your web app>/WEB-INF/lib

Some JDBC tutorials:

LVL 15

Expert Comment

ID: 10175525

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question