Nov

17

import java.sql.*;
import java.io.*;
class TestDb3{
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”);
Console c=System.console();
String qu=c.readLine(“Enter insert sql : “);
//qu=”insert into emp values(3,’uu’,’70070′)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);
}catch(Exception e){
System.out.println(e);
}
}
}


Leave a Reply