FreeKB - Resolve "No suitable driver found for jdbc/mySQL" in Java
Resolve "No suitable driver found for jdbc/mySQL" in Java

Home > Search


No suitable driver found for jdbc/mySQL appears when attempting to make a connection to a mySQL database in Java.

First and foremost, you will need to ensure that your application server has been configured properly to use the database driver JAR to handle JDBC connections. When configuring the application server, it is important to ensure that the JNDI name is properly formatted. In this case, the proper JNDI name for mySQL is jdbc/mySQL (this is case sensitive).

You will also need to ensure that the JNDI name is properly formatted in your Java application. In this case, the proper JNDI name for mySQL is jdbc/mySQL.

<sql:query var="myvar" dataSource="jdbc/mySQL">
    select * from foo;
</sql:query>

 

If you are connecting to a database in a JSP page via a DataSource, ensure you've the following imports in your JSP page.

<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments