-2

I need help with my project when I try to run the project using myBatis, SQL Connector and Maven and I just get that error:

 "no suitable jdbc driver found"

I have no clue how to fix this from now on.

public void openConnection() throws IOException, SQLException {

    ///database/src/main/java/Mappers/

    String resource = "mybatis-config.xml";
    InputStream inputStream = Resources.getResourceAsStream(resource);
    SqlSessionFactory sqlSessionFactory = 
                    new SqlSessionFactoryBuilder().build(inputStream); 

    session = sqlSessionFactory.openSession();

    updateData();
}

private void updateData() {
    int createTable = session.update("database.resources.createTableToTest");
    int addTable = session.update("database.resources.addToTest"); 

    test();
}
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
xDotcom
  • 1
  • 2

1 Answers1

0

You have to set classpath for your connector.jar in eclipse using build path and
You also have to put connector.jar to the lib folder of WEB-INF Directory.

Tim Weber
  • 858
  • 4
  • 14
  • Nothing in the question suggests that MySQL is used, why mention MySQL? – Mark Rotteveel Jan 17 '17 at 12:25
  • Thanks for your comment. What should the buildpath point on? Also, I don't have a WEB-INF directory. Am I missing something important out? – xDotcom Jan 17 '17 at 16:46
  • @xDotcom I don't know how myBatis work but : You should have a connector for sql (and add it in the buildpath in your project properties. Also, i supposed that you have a libraires folder (in webapp , we have it in WEB-INF/lib) and you have to put it in. – Tim Weber Jan 18 '17 at 08:21