• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 788
  • Last Modified:

How do I get my web application to connect to mysql again?

I am having this weird issue with my jsp application when trying to connect to mysql. It started to occur when I migrated from netbeans 5.5 to the netbeans 6 beta... in 5.5 I was using tomcat is the integrated j2ee server, however, in 6 they now use sun java application server 9.1, somewhere between the two my application stopped being to read the mysql database even though the connector jar is included in the package as a library. Here is what I get when I attempt to login to my application:

HTTP Status 500 -

type Exception report


descriptionThe server encountered an internal error () that prevented it from fulfilling this request.


javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:mysql://"

root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:mysql://"

note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1 logs.
Sun Java System Application Server 9.1

Again the mysql connector is already included in the package.. so that fact that it cannot find a driver is beyond me.

A working fix to this problem is worth 500 points.

  • 3
  • 3
1 Solution
Looking at this exception message, suggests that the driver is not there in
the classpath or not bundled with the application.
richardsimnettAuthor Commented:
I dont know why that would be a problem. I thought it was a class path issue as well, tahts why I double checked to make sure the jar was included in the package as a library. I have also investigated the .war file for the application, and the mysql-connector is there in the /WEB-INF/lib directory.... so I have no idea what the issue is.

can you post the code where you are making the connection?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

richardsimnettAuthor Commented:
<%-- manage a login attempt --%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>

<%-- set up the datasource --%>
<sql:setDataSource var="dblogin" url="jdbc:mysql://" driver="com.mysql.jdbc.Driver" user="pdev" password="pdev2k7"></sql:setDataSource>

<%-- first query the database for the username and password --%>
<sql:query var="login" dataSource="${dblogin}">
    select id from users where username='${param.username}' and password='${param.password}'  
richardsimnettAuthor Commented:
nm got it... had to copy the mysql-connector.jar to the JRE's classpath /lib/ext
Try Class.forName() before setDataSource
Closed, 500 points refunded.
Community Support Moderator

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now