Issue
I am trying to write a Java program using JDBC class to manipulate a MySQL database. I have imported the .jar file and customized the Drivers in 'Service' Part. However the a 'Package does not exist error' occurs when I trying to instantiating the imported MySQL Driver class by referencing the super-interface Driver. What can I do to fix the problem?
Here's my code and error pop-up:
Here's my database drivers setting in 'Service':
Solution
This works for me. Using the link you provided, I downloaded and installed the MySQL workbench thingy (whatever that is), and then located the Java driver under C:\Program Files (x86)\MySQL\Connector J 8.0
.
I added that driver to a new NetBeans project (as a library, under Library right click and choose Add Jar/Folder) and it worked fine, with NetBeans even suggesting the packages as I typed them.
package stackoverflow;
/**
*
* @author Brenden
*/
public class JConnect {
public static void main( String[] args ) throws Exception {
com.mysql.cj.jdbc.Driver driver = new com.mysql.cj.jdbc.Driver();
}
}
Answered By - markspace