Nov
17
import java.sql.*;
import java.io.*;
class TestDb4{
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 empno=c.readLine(“Enter Emp No: “);
String empName=c.readLine(“Enter Emp Name: “);
String empMob=c.readLine(“Enter Emp Mobile: “);
String qu=”insert into emp values(“+empno+”,'”+empName+”‘,'”+empMob+”‘)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);
}catch(Exception e){
System.out.println(e);
}
}
}