-1

I am using Java 14 and NetBeans12 and I don't know to add MySQL connector with my java program which I have written in NetBeans.I am getting an error which says "Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" I have downloaded and installed MySQL,Workbench and I have also downloaded MySQL connector but don't know how to import MySQL connector and Load JDBC Driver into my program.

1 Answers1

0

To make it work you must add into libs or libraries of your project the jar file of mysql.

https://www.mysql.com/products/connector/ Here you will find the aproppiate driver for your needs, i haven't tryied anything so this is all i can do for you right now.

In my git there is a connection using sqlite3 with a tiny script as an example of usage and its jdbc driver ready for import into libraries.

I hope it helped you!

https://github.com/saaimons/Java

saaimonsg
  • 16
  • 1
  • I am using netbeans12 and java with maven but can't find the option to add libraries – Pawan Kumar Sep 26 '20 at 09:36
  • Look at the left side panel, in the treeview there is one folder that says libraries. Right -click on it and select add jar/zip library, then you look up for the jar. If you download the jar I shared in github, you just copy the code and it should be ready to run. Image: https://www.tutorialspoint.com/maven/images/nb_project_structure.jpg – saaimonsg Oct 05 '20 at 06:48