Nov
17
import java.sql.*;
class TestDb{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
String qu=”drop table emp”;
stmt.execute(qu);
System.out.println(“table dropped”);
qu=”create table emp(empno number(2),ename varchar2(50),mobile varchar2(20))”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“table created”);
}catch(Exception e){
System.out.println(e);
}
}
}
Leave a Reply
No Comments