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

Updated:   |  Java articles

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.*" %>

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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