Support Scrollable ResultSet

In this chapter you will learn:

  1. If database support scrollable result sets

Scrollable ResultSet

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
//from   j a v a2s. c  o  m
public class Main {

  public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData metadata = conn.getMetaData();

    boolean supportForwardOnly = metadata.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY);
    System.out.println("supportForwardOnly = " + supportForwardOnly);

    boolean supportScrollInsensitive = metadata
        .supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
    System.out.println("supportScrollInsensitive = " + supportScrollInsensitive);

    boolean supportScrollSensitive = metadata
        .supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
    System.out.println("supportScrollSensitive = " + supportScrollSensitive);
    conn.close();
  }

  private static Connection getHSQLConnection() throws Exception {
    Class.forName("org.hsqldb.jdbcDriver");
    String url = "jdbc:hsqldb:data/tutorial";
    return DriverManager.getConnection(url, "sa", "");
  }

}

Next chapter...

What you will learn in the next chapter:

  1. Get to know the three types of JDBC statements
Home » Java Tutorial » Driver and Connection

Introduction

    JDBC

Driver

    Driver
    Driver Loaded
    Login Timeout
    Driver Available Parameters
    Driver version
    JDBC logging

Connection

    Connection
    Connection Properties
    Connection Charset
    JDBC ODBC Bridge
    HSQL memory based database

Database Meta Data

    All key words
    Table schema
    Table catalog
    Database version
    Database product version and name
    Data type information
    Transaction level
    Connection User name, URL and driver version
    All table names
    Get all column names
    Table existance
    System Functions Supported
    Date time function
    Numeric Functions Supported
    String functions
    Feature support
    Connection Limit
    Support Scrollable ResultSet