troubleshooting Question

database connection

Avatar of Raftor
Raftor asked on
16 Comments1 Solution309 ViewsLast Modified:
Hi Experts,

I am having trouble connecting to a mysql database.  For simplicity i have two files 1) dbconnect.jsp and 2) display_results.jsp.  

      String inServer = "irpclanadmin1";
      String inDBName = "leave";
      String DATABASE_URL = "odbc:mysql://" + inServer + ":3306/" + inDBName;      
      Connection con = DriverManager.getConnection(DATABASE_URL, "username","pass");

<%@ page language ="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ include file="dbconnect.jsp" %>
      Statement stmt = con.createStatement();
      ResultSet check = stmt.executeQuery("SELECT userSName FROM userdetails");
      String userName = "";
            userName = check.getString(1);

The problem is i am getting this displayed when i open display_results.jsp
javax.servlet.ServletException: com.mysql.odbc.Driver
at org.apache.jasper.runtime.PageContextImpl.handlePageException(
at org.apache.jsp.display_0005fresults$jsp._jspService(display_0005fresults$
at org.apache.jasper.runtime.HttpJspBase.service(

Any help would be greatly appreciated
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 16 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros