File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Demonstrating DROP TABLE Command
2
+ import java .sql .Connection ;
3
+ import java .sql .DriverManager ;
4
+ import java .sql .SQLException ;
5
+ import java .sql .Statement ;
6
+
7
+ public class JDBCExample4 {
8
+ static final String DB_URL = "jdbc:mysql://localhost/TUTORIALSPOINT" ;
9
+ static final String USER = "guest" ;
10
+ static final String PASS = "guest123" ;
11
+
12
+ public static void main (String [] args ) {
13
+ // Open a connection
14
+ try (Connection conn = DriverManager .getConnection (DB_URL , USER , PASS );
15
+ Statement stmt = conn .createStatement ();
16
+ ) {
17
+ String sql = "DROP TABLE REGISTRATION" ;
18
+ stmt .executeUpdate (sql );
19
+ System .out .println ("Table deleted in given database..." );
20
+ } catch (SQLException e ) {
21
+ e .printStackTrace ();
22
+ }
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments