JDBC JAVA No suitable drivers found for jdbc: mysql: // localhost: 3306 / vote


Hello im trying to connect to a mysql database using JDBC my code is below.I get an error as such No suitable driver found.Searching around I found that the usual error is syntax or missing the jar file from the class path.I tried both of these solutions and dont know what to do next it wont connect.Also to manage the databases I have WAMP and mySQL workbench installed not sure if its related.

package test.jdbc;
import java.sql.*;

public class jdbctester {

public static void main(String[] args)

        Connection myconn=DriverManager.getConnection("jdbc:mysql://localhost:3306/voting","root","Vanquish123");
        Statement myStmt=myconn.createStatement();
        ResultSet myRs=myStmt.executeQuery("select * from electoral");
    catch(Exception exc)


Try this:

Class.forName("fully qualified driver class name");

Java Class.forName, JDBC connection loading driver

this post states that you should not need it but it will not hurt you to try.