import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class Jdbc2 {
public static void main(String[] args) throws ClassNotFoundException
{
// Loading & Register the Type-1 Driver Class(JdbcOdbcDriver). But this line is optional
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Establishing the connection
try(Connection con=DriverManager.getConnection("jdbc:odbc:alt","system","manager"))
{
// Creating statement to execute query
Statement st=con.createStatement();
// Executing Query
st.executeUpdate("drop table emp");
System.out.println("Table Dropped");
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class Jdbc2 {
public static void main(String[] args) throws ClassNotFoundException
{
// Loading & Register the Type-1 Driver Class(JdbcOdbcDriver). But this line is optional
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Establishing the connection
try(Connection con=DriverManager.getConnection("jdbc:odbc:alt","system","manager"))
{
// Creating statement to execute query
Statement st=con.createStatement();
// Executing Query
st.executeUpdate("drop table emp");
System.out.println("Table Dropped");
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
0 Comment to "Jdbc Program to drop the 'emp' table."
Post a Comment