The error I am getting is PY4JAVAERROR :
an error occurred while calling o313.load: Java.lang.classnotfoundexception: com.mysql.jdbc.Driver
has anyone encountered this before?
The error I am getting is PY4JAVAERROR :
an error occurred while calling o313.load: Java.lang.classnotfoundexception: com.mysql.jdbc.Driver
has anyone encountered this before?
That occurs when you don't have a MySQL connector in your classpath. If you are using a maven project you can try adding the dependency to your pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
If you are not using a dependency management tool like Maven or Gradle you can download the jar online and then add it to your classpath. Here is the link. https://dev.mysql.com/downloads/connector/j/
Remember to do a bit of research for the correct versions before you download. Either of the two options will definitely work.
It seems the mysql
connectivity library is not included in the project. Solve the problem following one of the proposed solutions:
MAVEN PROJECTS SOLUTION
Add the mysql-connector
dependency
to the pom.xml
project file:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version> // your desired version
</dependency>
Here you are all the versions: https://mvnrepository.com/artifact/mysql/mysql-connector-java
ALL PROJECTS SOLUTION Add the jar library manually to the project.
Right Click the project -- > build path -- > configure build path
In Libraries Tab press Add External Jar
and Select your jar
.
You can find zip for mysql-connector here
Explanation:
When building the project, java throws you an exception because a file (the com.mysql.jdbc.Driver class
) from the mysql
connectivity library is not found. The solution is adding the library to the project, and java will find the com.mysql.jdbc.Driver