30-08-2011, 12:20 PM
import java.sql.*;
import java.io.*;
public class JDBCupdate
{
public static void main(String args[])
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection
("jdbc:odbc:rama;uid=scott;pwd=tiger;");
Statement st=c.createStatement();
String stname="sunil";
String temp;
int stno=3;
DataInputStream stdin=new DataInputStream(System.in);
System.out.print("Enter the stno:");
System.out.flush();
temp=stdin.readLine();
stno=Integer.parseInt(temp);
System.out.print("Enter the new name:");
System.out.flush();
stname=stdin.readLine();
try{
st.executeUpdate("INSERT INTO student VALUES(136,'venkat',82)");
// System.out.println("Number of ROWS effected:"+i);
}
catch(Exception e)
{
System.out.println("inside:"+e);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}