Deletes Records from Access/SQL table - Java Database Connectivity

Home  »  Java  »  Advance Java  »  Java Database Connectivity  »  Deletes Records


This example deletes records into the Access table 'StudentTable' on the harddisk, using classes of the java.sql package and 'Views' the rows inserted.

  •  A JDBC-ODBC bridge driver is loaded
  •  A Connection to the database is made, using getConnection method()
  •  Using the Connection object, SQL's 'Delete from' statement is sent to the database
  •  A message is printed on the command line indicating the command was successful
  •  Minimal exception handling is done


To delete rows into the table 'StudentTable' the executeUpdate() method is used. To display the results retrieved from the table the rs.next() method is used.




The Output of DeleteRecords is as shown below:
Diagram 22.18 DeletesRecords from Access StudentTable table



Create the Database.
Creating a DSN.
Connecting to a Database.
Creating & Executing Statements.
Closing a database connection.




JDBC - Programming:

View records from the Access/SQL table.
Inserts records into the Access/SQL table.
Updates records into the Access/SQL table.
Deletes records from the Access/SQL table.
Drops the Access/SQL table.




JDBC - Working With User Interfaces - Using Swing Compoents

Inserts records into the Access/SQL table using Swing Components
View records from the Access table/SQL using Swing JTable
Updates records into the Access/SQL table using Swing Components
Deletes records from the Access/SQL table using Swing Components





No comments:

Post a Comment