code: public static String fetchConstraint(Connection connection, String catalogName, String schemaName, String tableName) throws SQLException {
          // Merge column constraint and table constraint
          PreparedStatement pst = SFSUtilities.prepareInformationSchemaStatement(connection, catalogName, schemaName,
                  tableName, "INFORMATION_SCHEMA.CONSTRAINTS", "", "TABLE_CATALOG", "TABLE_SCHEMA","TABLE_NAME");
          try (ResultSet rsConstraint = pst.executeQuery()) {
              StringBuilder constraint = new StringBuilder();
              while (rsConstraint.next()) {
                  String tableConstr = rsConstraint.getString("CHECK_EXPRESSION");
                  if(tableConstr != null) {
                      constraint.append(tableConstr);
                  }
              }
              return constraint.toString();
          } finally {
              pst.close();
          }
      }
docs: Read table constraints from database metadata.
  @param connection Active connection
  @param catalogName Catalog name or empty string
  @param schemaName Schema name or empty string
  @param tableName table name
  @return Found table constraints
  @throws SQLException