Third, click on the Add JAR folder button, browse to the location where you installed MySQL Connector/J, and choose the JAR file as screenshot below after that click OK button. Second, on the left hand side of the project properties dialog, from the Categories section, choose Libraries item. The project properties dialog will appear. To load MySQL Connector/J into your program you follow three steps below:įirst, in NetBeans IDE, from project name, right mouse click and choose properties menu item. Loading MySQL Connector/J into your program Then you can use this Connection object to execute queries. Create a new Connection object from the DriverManager class.Load the MySQL Connector/J into your program.To connect to MySQL database from a Java program, you need to do the following steps: In this tutorial, you will learn how to connect to MySQL database using JDBC Connection object.