R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

JDBC

JDBC Projects

JDBC Project 1

JDBC Using Statement example Delete all record
Previous Home Next
/* This program shows you how to delete all
rows from the database table using JDBC
Statement.*/

package r4r;
import java.sql.*;
public class DeleteAllData {
public static void main(String[] args) {
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","oracle");
Statement stmt=con.createStatement();
stmt.executeQuery("delete from user5 ");
System.out.println("successfully deleted");
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}

output:

successfully deleted
Previous Home Next