-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJDBCExample4.java
More file actions
24 lines (22 loc) · 787 Bytes
/
JDBCExample4.java
File metadata and controls
24 lines (22 loc) · 787 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
// Demonstrating DROP TABLE Command
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBCExample4 {
static final String DB_URL = "jdbc:mysql://localhost/TUTORIALSPOINT";
static final String USER = "guest";
static final String PASS = "guest123";
public static void main(String[] args) {
// Open a connection
try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
Statement stmt = conn.createStatement();
) {
String sql = "DROP TABLE REGISTRATION";
stmt.executeUpdate(sql);
System.out.println("Table deleted in given database...");
} catch (SQLException e) {
e.printStackTrace();
}
}
}