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

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

Hello,
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

message

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

exception

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

root cause

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

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.

Thanks,
Rick
0
richardsimnett
Asked:
richardsimnett
  • 3
  • 3
1 Solution
 
Ajay-SinghCommented:
Looking at this exception message, suggests that the driver is not there in
the classpath or not bundled with the application.
0
 
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.

0
 
Ajay-SinghCommented:
can you post the code where you are making the connection?
0
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://192.168.1.4/pdev" 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}'  
</sql:query>
0
 
richardsimnettAuthor Commented:
nm got it... had to copy the mysql-connector.jar to the JRE's classpath /lib/ext
0
 
Ajay-SinghCommented:
Try Class.forName() before setDataSource
0
 
Vee_ModCommented:
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

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