Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

I am getting an error when I try to create a data source like this:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I found that I have to add a jar on the classpath and I have no idea how to do it. Can someone help me with this?

1 Answer

0 votes
by (13.1k points)

Go to  http://dev.mysql.com/downloads/connector/j and in the dropdown select “Platform independent” then it will show you the options to download the tar.gz file or zip file.

Download the zip file and extract it, within that you will find mysql-connector-xxx.jar file.

If you are using maven then you can add the dependency from the link  http://mvnrepository.com/artifact/mysql/mysql-connector-java

Select the version you want to use and add the dependency in your pom.xml file.

Want to learn Java? Check out the core Java certification from Intellipaat.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...