Professional Documents
Culture Documents
DBConnection.class – intended for connecting your database and java program using the needed
privileges like database username and database password
QueryProcessor – intended for calling sql query for reading and writing data or information to your
database. Queries like insert into, select, update and delete .
Username
Password
Check All
*Remember your username and password of your database, so that its easier for you to configure the
DBConnection.class in your Java Project.
3.4 Confirmation that you have created a new Account to your Database.
Step 4. Using the username and password in your database, Open the DBConnection.class in your Java
Project and modify the jdbc:driver.
Database password
Database name
Database username
*MySQL JDBC Driver is a library or API that connects MySQL and Java Projects. Without this library in
your project, it will cause an error.
5.2 Right click on the Library Folder of your Java Project, and Select “Add Library”.
Step 6. Calling the QueryProcessor.class and DBConnection.class to determine that you are
successfully connected with MySql.
To do that. Let us remember , that QueryProcessor and DBConnection.class are separate classes,
separate to your main class. In order to access them is to create an object for them. But Before that,
let us analyze first diagram.
SimpleDatabaseProgram.java
1
(Main Class)
4
2
QueryProcessor.java DBConnection.java
*This diagram shows that in order to determine that you are connected to your MySQL. The main
class or the class, will call the QueryProcessor.class and the QueryProcessor.class will call the
DBConnection.class and the DBConnection will return the result Successfully Connected or Not.
If the connection is not successful, you cannot perform the query like. Select, insert into, update,
delete and etc.
6.1 In your main class, to call the QueryProcessor.class, we must create an Object for that class.