javaintegration-testingsqlexceptiondbsetup

DbSetup simple example, SQLException occurs


There's very little information about DbSetup so I couldn't find an answer to this question anywhere else. I need to test Data Access Layer and decided to use DbSetup for it. I tried to use DbSetup user guide this example just to see how it works but I get such exception:

com.ninja_squad.dbsetup.DbSetupRuntimeException: java.sql.SQLException: No suitable driver found for 127.0.0.1:3306

My database is MySQL Server. What could be the problem?


Solution

  • Your URL is incorrect. JDBC URL for MySQL looks like

    jdbc:mysql://localhost:3306/databasename
    

    as described in the documentation.

    And of course, the jar of the MySQL JDBC driver must be in the classpath.