Determining If a Database Supports Updatable Result Sets - Java JDBC

Java examples for JDBC:ResultSet

Description

Determining If a Database Supports Updatable Result Sets

Demo Code

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

public class Main {
  public static void main(String[] argv) throws Exception {
    try {/*w  w w.j  a  va2s  .c o  m*/
      Connection connection = null;
      DatabaseMetaData dmd = connection.getMetaData();
      if (dmd.supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY,
          ResultSet.CONCUR_UPDATABLE)) {
        // Updatable result sets are supported
      } else {
        // Updatable result sets are not supported
      }
    } catch (SQLException e) {
    }
  }
}

Related Tutorials