Write a java program to create a table through frontend application?



import java.sql.*;
class CreateTable {
 public static void main(String[] args) {
   try {
    Class.forName("Sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("DRIVERS LOADED...");
    Connection con = DriverManager.getConnection("jdbc:odbc:oradsn", "scott", "tiger");
    System.out.println("CONNECTION ESTABLISHED...");
    Statement st = con.createStatement();
    int i = st.executeUpdate("create table kalyan (eno number (4), ename varchar2 (15))");
    System.out.println("TABLE CREATED...");
    con.close();
   } catch (Exception e) {
    e.printStackTrace();
   }
  } // main
}  // CreateTable


No comments:

Post a Comment