ResultSet: getInt(String columnName) : ResultSet : java.sql : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP
Java by API Home »  java.sql   » [  ResultSet  ]   
 



ResultSet: getInt(String columnName)

import javax.sql.rowset.CachedRowSet;

public class Main {
  

  public static void main(String[] argsthrows Exception {
    CachedRowSet rs;
    String ROWSET_IMPL_CLASS = "com.sun.rowset.CachedRowSetImpl";
    
    
    Class c = Class.forName(ROWSET_IMPL_CLASS);
    rs = (CachedRowSetc.newInstance();

    rs.setUrl("jdbc:postgresql:dbname");
    rs.setUsername("username");
    rs.setPassword("password");

    rs.setCommand("select * from members where name like ?");
    rs.setString(1"I%");

    rs.execute();

    while (rs.next()) {
      if (rs.getInt("id"== 42) {
        rs.setString(1"newString");
        rs.updateRow()// Normal JDBC

        rs.acceptChanges();
      }
    }
    rs.close();
  }
}

           
       
Related examples in the same category
1.  ResultSet.CONCUR_UPDATABLE
2.  ResultSet.TYPE_SCROLL_SENSITIVE
3.  ResultSet: absolute(int row)
4.  ResultSet: close()
5.  ResultSet: deleteRow()
6.  ResultSet.getAsciiStream(int columnIndex)
7.  ResultSet: getBlob(String colName)
8.  ResultSet: getConcurrency()
9.  ResultSet: getRow()
10.  ResultSet: getString(int columnIndex)Has Download File
11.  ResultSet: getTimestamp(int columnIndex)
12.  ResultSet: getType()
13.  ResultSet: insertRow()
14.  ResultSet: isFirst()
15.  ResultSet: last()
16.  ResultSet: moveToInsertRow()
17.  ResultSet: next()
18.  ResultSet: previous()
19.  ResultSet: relative(int rows)
20.  ResultSet: updateRow()
21.  ResultSet: updateDouble(int columnIndex, double x)
22.  ResultSet: updateString(String columnName, String x)
23.  ResultSet: wasNull()
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.