-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_in_jdbc.java
35 lines (30 loc) · 1017 Bytes
/
delete_in_jdbc.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.*;
import java.sql.*;
class delete{
public static void main(String args[])throws IOException
{
DataInputStream ds = new DataInputStream(System.in);
System.out.println("enter empid whose record is to be deleted");
String eno=ds.readLine();
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","manager");
Statement stmt = con.createStatement();
String q1 = "delete from e_reg where e_id='"+eno+"'";
int x = stmt.executeUpdate(q1);
if(x>0)
{
System.out.println("delete success");
}
else
{
System.out.println("delete unsuccess");
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}