Determining If a Database Supports Scrollable Result Sets - Java JDBC

Java examples for JDBC:ResultSet

Description

Determining If a Database Supports Scrollable Result Sets

Demo Code

import java.awt.Graphics;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
  public void m() {
    try {/*from   w  ww . j  a  va2 s.  c  o  m*/
      Connection connection = null;
      DatabaseMetaData dmd = connection.getMetaData();
      if (dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)) {
        // Insensitive scrollable result sets are supported
      }
      if (dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)) {
        // Sensitive scrollable result sets are supported
      }
      if (!dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)
          && !dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)) {
        // Updatable result sets are not supported
      }
    } catch (SQLException e) {
    }
  }
}

Related Tutorials