Home Java Java Mysql JDBC Crud using EclipseIDE

Java Mysql JDBC Crud using EclipseIDE

11 min read
0
0
348

This JDBC will teach you how to do basic database functions that are CREATE RETIEVE UPDATE and DELETE using Mysql Database. The INSERT, SELECT, UPDATE and DELETE statements can be used in any database system, because this is support by all relational database systems.

We will learn how to INSERT, SELECT, UPDATE and DELETE in database by writing code to manage the records table in the database named dscomputers.  records table consist of following columns name,item,price.

Feature of projects

The system shall be able to record computer details : name,item,price.

The system  shall be able to retrieve the computer details : name,item,price.

Then system shall be able to Edit and Delete the computer details : name,item,price.

Learn how to make this System Step by step

Step 1: Download JDK  Click here  follow the steps and install it.

Step 2: Download an appropriate jdbc driver Click here in order to connect jdbc and mysql.

Step 3: Download xampp server Click here   follow the steps and install it.

First Step :   Create the Database. in this example we created as dscomputers as a Database Name.

After created the database you have create tables inside the database. i have created the table which name it as
records. records tables consist of following coloums (id,name,item,price) 

id coloum should be AUTO INCREMENT Field.

After Done the database design. lets moving to the Form Design .

After Done the Design. Lets moving to the Code Part.

First Step : we  have to create the  method maintenance  that are CREATE RETIEVE UPDATE and DELETE all the functions can manage. switch case will manage all crud crud operations.

At the top we add the namespace  for writing the sql . import java.sql.*;

Add Records

you can use the following code snippet to add the records in to database. paste the code inside the Save button.
maintenance(1);  if you write what happens here is when you click save button it will goes to the function maintenance and search the case which would be match the value of 1. the particular case will be executed.record will be inserted in to the database.at the same time we will receieve message as record inserted successfully.after that we call the function maintenance(5);  here also same thing happen search the case which would be match the value of 5. the particular case will be executed.which will match to clear the records.

Find Records

you can use the following code snippet to find the records in to database. paste the code inside the Find button.
maintenance(3);  here also same thing happen search the case which would be match the value of 3. the particular case will be executed.which will match to Find the records.

Edit Records

you can use the following code snippet to find the records in to database. paste the code inside the Edit button.
maintenance(2);  here also same thing happen search the case which would be match the value of 2. the particular case will be executed.which will match to edit the records.

Delete Records

you can use the following code snippet to find the records in to database. paste the code inside the Delete button.
maintenance(4);  here also same thing happen search the case which would be match the value of 4. the particular case will be executed.which will match to delete the records.

Clear Records

you can use the following code snippet to find the records in to database. paste the code inside the Delete button.
maintenance(5);  here also same thing happen search the case which would be match the value of 5. the particular case will be executed.which will match to clear the records.

i have attached the video link below. which will do this tutorials step by step.

 

Load More Related Articles
Load More By admin
Load More In Java

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Sales Transaction Management in Java Mysql

The set of one or more sql statements that are executed as a single unit called as transac…