Steps to connect Java application to the database ♐
step 1:- Register the Driver class
step 2:- Connect to the Database
step 3:- Prepare/create Statement
step 4:- Execute Query
step 5: Close the connection
How to compile and run the program ❓
step 1: import the .jar file into your workspace
step2: compile the Java program as javac Example.java
step3: provide the complete jar file path and run the program as
java -p complete_path_of_jar_file.jar JavaFileName
Note 🗒️ :- There are various other methods of setting the path of jar file except this, so you set the path according
to your choice...
Qn no. 1:- Write a Java Program to show all the data of the table
Answer:- ConnectDb.java
Qn no. 2:- Write a Java Program to print only those records whose faculty is SE given table name Students
Answer:- StudentJDb.java