Q:

Servlet Database URL

I'm trying to have a servlet to connect and interact with a database. I'm very new at this topic, so there probably are a couple of big issues, but the main problem I'm stuck at is how to get the database URL. 
This is the servlet (I'm trying to keep it as light as possible)
import java.io.*;
import java.text.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class qaServlet extends HttpServlet{
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
                String firstName = request.getParameter("question");
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();

                try {
                    Class.forName("com.mysql.jdbc.Driver");
                    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/qaDatabase", "root", ""); 
//^HOW DO I GET THE RIGHT URL?^

                    PreparedStatement ps = con.prepareStatement("insert into faq values('1','question','sì');");
                    int i = ps.executeUpdate();
                }
                catch (Exception e2) {
                    System.out.println(e2);
                }
                out.close();
    }
}

A:

First, it is better to use e2.printStackTrace(); instead of System.out.println(e2); when debugging.
Second, as the exception has shown, the actual problem was missing JAR file with JDBC driver, which has to be either in the WEB-INF/lib folder of your application, or in Tomcat's lib folder.
When developing, don't forget to republish your project after adding the driver's JAR file.

