Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy am I receiving this SQLException error stating that no suitable driver can be found?
    primarykey
    data
    text
    <p>I'm on a mac, running a MAMP instance of MySQL. I'm trying to use a jdbc driver to connect my java code to a database called 'test', working with a table called 'customer.' I keep getting an error:</p> <pre><code>java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:8889/test </code></pre> <p>I'm not sure if the problem is with my code, or if it's a configuration problem with the MAMP instance of MySQL, or if it's something else entirely.</p> <p>I have an initialize driver method:</p> <pre><code>public void initializeDriver(){ try{ Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e) { System.err.println(e.toString()); } } </code></pre> <p>And I have a connection created in the following way:</p> <pre><code>public void insertCustomer(String connectionUrl, String connectionUser, String connectionPassword, Customer customer) { try{ Connection conn = DriverManager.getConnection(connectionUrl, connectionUser, connectionPassword); Statement constat = conn.createStatement(); String query = "INSERT INTO customers (customer_id, email, deliverable, create_date) VALUES (" + customer.id + ", " + customer.emailAddress + ", " + customer.deliverable + ", " + customer.createDate + ")" ; constat.executeQuery(query); conn.close(); } catch(SQLException e){ System.out.println(e.toString()); } } </code></pre> <p>And I have downloaded mysql-connector-java-5.1.20 and set it in my classpath.</p> <p>If anyone has any suggestions for how I could correct this error, I would be really grateful!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload