Monday, February 13, 2017

Jdbc Program to drop 'emp' table by using type-4 driver of oracle database .

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class Jdbc7
{
public static void main(String[] args)
{
try
{
Class.forName("oracle.jdbc.OracleDriver");
}
catch(ClassNotFoundException cn)
{
cn.printStackTrace();
}
// Establishing the connection
try(Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522:xe","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();
}
}
}

Share this

0 Comment to "Jdbc Program to drop 'emp' table by using type-4 driver of oracle database ."

Post a Comment