I'm trying to establish a connection to my mySQL database through a jdbc connection. I'm using a localhost connection at port 3006.
try{
Connection myConn = DriverManager.getConnection("JDBC:mysql://localhost:3306/cupcakes", "kristoffer", "******");
Statement myStmt = myConn.createStatement();
ResultSet myRs = myStmt.executeQuery("Select * from cupcakes");
while(myRs.next()){
System.out.println("Cupcakes: " + myRs.getString("name"));
i get this error: java.sql.SQLException: No suitable driver found for JDBC:mysql://localhost:3306/cupcakes at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:247) at driverappformysql.DriverAppforMYSQL.main(DriverAppforMYSQL.java:21)
How can i assure that i'm connecting to the correct database, and how can i get the right url?