Determining If a Database Supports Transactions - Java JDBC

Java examples for JDBC:Database Meta Data

Description

Determining If a Database Supports Transactions

Demo Code

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

public class Main {
  public static void main(String[] argv) {
    try {/*from w  w  w.  j a v  a  2s  .  c o m*/
      Connection connection = null;
      DatabaseMetaData dmd = connection.getMetaData();
      if (dmd.supportsTransactions()) {
        // Transactions are supported
      } else {
        // Transactions are not supported
      }
    } catch (SQLException e) {
    }
  }
}

Related Tutorials