-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram21.java
More file actions
21 lines (20 loc) · 889 Bytes
/
Copy pathProgram21.java
File metadata and controls
21 lines (20 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.sql.*;
public class Program21 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver is loaded");
Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "root");
System.out.println("Connection is established");
Statement stmt= con.createStatement();
System.out.println("System object is created");
// Query
stmt.executeUpdate("create table stud (sid number(3), sname varchar2(30), sadd varchar2(30))");
System.out.println("Table is created");
con.close();
stmt.close();
} catch (Exception e) {
System.out.println("Exception occurred: " + e);
}
}
}