-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuaryDb.java
More file actions
40 lines (26 loc) · 926 Bytes
/
Copy pathQuaryDb.java
File metadata and controls
40 lines (26 loc) · 926 Bytes
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
36
37
38
39
40
package com.javalab.qaTest;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class QuaryDb {
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
System.out.println("wAITING TO Connect");
// Register driver command
Class.forName ("oracle.jdbc.driver.OracleDriver");
System.out.println(" NOT Connected YET");
// open connection to the database
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:TESTSCH", "system", "oracle");
System.out.println("Connected");
Statement st =conn.createStatement(); // Create statement variable
String sql = "delete from oreder where orderid = 1";
st.executeUpdate(sql);
System.out.println("Statement was excuted properly");
conn.close();
}catch (Exception e){
System.out.println(e);
}
}
}