If database support updatable result sets : ResultSet Updatable « Database SQL JDBC « Java






If database support updatable result sets

  
 

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

public class Main {
  private static final String DRIVER = "com.mysql.jdbc.Driver";

  private static final String URL = "jdbc:mysql://localhost/yourDatabase";

  private static final String USERNAME = "root";

  private static final String PASSWORD = "";

  public static void main(String[] args) throws Exception {
    Class.forName(DRIVER);
    Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
    DatabaseMetaData metadata = connection.getMetaData();

    boolean updatable = metadata.supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY,
        ResultSet.CONCUR_UPDATABLE);

    System.out.println("Updatable ResultSet supported = " + updatable);
    connection.close();
  }
}

   
    
  








Related examples in the same category

1.Using UpdatableResultSet to insert a new row
2.Delete Row from Updatable ResultSet for MySQL
3.Insert Row to Updatable ResultSet from MySQL
4.Make updates in Updatable ResultSet
5.Demo Updatable ResultSet
6.Updatable resultset with Oracle Driver
7.Determining If a Database Supports Updatable Result Sets: An updatable result set allows modification to data in a table through the result set.
8.Creating an Updatable Result Set
9.Determining If a Result Set Is Updatable
10.Updating a Row in a Database Table Using an Updatable Result Set
11.Cancelling Updates to an Updatable Result Set
12.Inserting a Row into a Database Table Using an Updatable Result Set
13.Deleting a Row from a Database Table Using an Updatable Result Set
14.Refreshing a Row in an Updatable Result Set