import java.sql.*;public class DBOperation
{
static String dataBase="jdbc:odbc:test";

public static void main (String[] args)
{
/*String createTable="create table COFFEE"+
                   "(COF_NAME VARCHAR(32), "+
                   "SUPERID INTEGER, "+
                   "PRICE FLOAT, "+
                   "SALES INTEGER, "+
                   "TOTAL INTEGER)";*/

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.out.println("Error:.."+e.toString());
}

try {
Connection con=DriverManager.getConnection(dataBase);
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//stmt.executeUpdate("update coffee set sales=75 where cof_name='Colombian'");
//PreparedStatement statement=con.prepareStatement("UPDATE COFFEE SET SALES=? WHERE COF_NAME=?");
//statement.executeUpdate();
//statement.setInt(1,6);
//statement.setString(2,"'Colombian'");
    //int n=statement.executeUpdate();
ResultSet rst=stmt.executeQuery("select sales from coffee");
rst.absolute(3);
rst.updateInt("sales",50);
rst.updateRow();
//System.out.println("The volumn is: "+n);
System.out.println("The new sales is: "+rst.getInt("SALES"));
stmt.close();
//statement.close();
con.close();
} catch(SQLException ex) {
System.out.println("SQLException: "+ex.toString());
System.out.println("SQLException: "+ex.getSQLState());
}
}
}