java.sql.SQLException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中java.sql.SQLException.getLocalizedMessage()方法的一些代码示例,展示了SQLException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLException.getLocalizedMessage()方法的具体详情如下:
包路径:java.sql.SQLException
类名称:SQLException
方法名:getLocalizedMessage

SQLException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

public static void rollback(final Connection conn, final Logger logger) {
  try {
    if (null != conn) {
      conn.rollback();
    }
  } catch (final SQLException sqe) {
    logger.warn("The following problem occurred while trying to rollback " + conn + ": " + sqe.getLocalizedMessage());
    if (logger.isDebugEnabled()) {
      logger.debug("", sqe);
    }
  }
}

代码示例来源:origin: zendesk/maxwell

private void probePool( ConnectionPool pool, String uri ) throws SQLException {
  try (Connection c = pool.getConnection()) {
    c.createStatement().execute("SELECT 1");
  } catch (SQLException e) {
    LOGGER.error("Could not connect to " + uri + ": " + e.getLocalizedMessage());
    throw (e);
  }
}

代码示例来源:origin: apache/kylin

@RequestMapping(value = "/tables_and_columns", method = RequestMethod.GET, produces = { "application/json" })
@ResponseBody
public List<TableMeta> getMetadata(MetaRequest metaRequest) {
  try {
    return queryService.getMetadata(metaRequest.getProject());
  } catch (SQLException e) {
    throw new InternalErrorException(e.getLocalizedMessage(), e);
  }
}

代码示例来源:origin: zendesk/maxwell

} catch ( SQLException e ) {
  LOGGER.error("SQLException: " + e.getLocalizedMessage());
  System.exit(1);
} catch ( URISyntaxException e ) {

代码示例来源:origin: xalan/xalan

/**
  * Build up an SQLErrorDocument that includes the basic error information
  * along with the Extended SQL Error information.
  * @param mgr
  * @param ident
  * @param error
  */
 public SQLErrorDocument( DTMManager mgr, int ident, SQLException error )
 {
  super(mgr, ident);

  createExpandedNameTable();
  buildBasicStructure(error);

  int sqlError = addElement(2, m_SQLError_TypeID, m_extErrorID, m_MainMessageID);
  int element = DTM.NULL;

  element = addElementWithData(
   new Integer(error.getErrorCode()), 3,
   m_Code_TypeID, sqlError, element);

  element = addElementWithData(
   error.getLocalizedMessage(), 3,
   m_Message_TypeID, sqlError, element);

//    this.dumpDTM();
 }

代码示例来源:origin: xalan/xalan

se.getLocalizedMessage(), 3,
m_Message_TypeID, sqlError, element);

代码示例来源:origin: zendesk/maxwell

LOGGER.error(e.getLocalizedMessage());
e.printStackTrace();
System.exit(1);

代码示例来源:origin: apache/hive

console.printError("Failed processing command " + tokens[0] + " " + e.getLocalizedMessage(),
 org.apache.hadoop.util.StringUtils.stringifyException(e));
ret = 1;

代码示例来源:origin: apache/nifi

} catch (SQLException se) {
  logger.debug("Cannot set fetch size to {} due to {}", new Object[]{fetchSize, se.getLocalizedMessage()}, se);

代码示例来源:origin: apache/nifi

} catch (SQLException se) {
  logger.debug("Cannot set fetch size to {} due to {}", new Object[]{fetchSize, se.getLocalizedMessage()}, se);

代码示例来源:origin: apache/nifi

} catch (SQLException se) {
  logger.debug("Cannot set fetch size to {} due to {}", new Object[]{fetchSize, se.getLocalizedMessage()}, se);

代码示例来源:origin: geotools/geotools

LOGGER.fine(e.getLocalizedMessage());
if (LOGGER.isLoggable(Level.FINE)) {
  LOGGER.fine(
      "Exception occurred while doing rollback:\n" + e.getLocalizedMessage());

代码示例来源:origin: apache/cloudstack

} catch (SQLException e) {
  s_logger.info("[ignored]"
      + "SQL failed to delete vm work job: " + e.getLocalizedMessage());
} catch (Throwable e) {
  s_logger.info("[ignored]"
} catch (SQLException e) {
  s_logger.info("[ignored]"
      + "SQL failed to delete async job: " + e.getLocalizedMessage());
} catch (Throwable e) {
  s_logger.info("[ignored]"

代码示例来源:origin: apache/cloudstack

pstmt.executeUpdate();
} catch (SQLException e) {
  s_logger.info("[ignored] error during network offering update:" + e.getLocalizedMessage(), e);
} finally {
  closeAutoCloseable(rs);

代码示例来源:origin: KylinOLAP/Kylin

private ResultSet mockEmptyResultSet() {
  AvaticaResultSet resultSet = null;
  try {
    List<ColumnMetaData> columnMetas = new ArrayList<ColumnMetaData>();
    List<Object[]> data = new ArrayList<Object[]>();
    resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, new KylinEnumerator<Object[]>(data), ColumnMetaData.struct(columnMetas)), this.conn.getTimeZone());
    KylinConnectionImpl.TROJAN.execute(resultSet);
  } catch (SQLException e) {
    logger.error(e.getLocalizedMessage(), e);
  }
  return resultSet;
}

代码示例来源:origin: KylinOLAP/Kylin

public ResultSet getTableTypes() {
  List<ColumnMetaData> tableTypeMeta = new ArrayList<ColumnMetaData>();
  tableTypeMeta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), false));
  List<Object[]> data = new ArrayList<Object[]>();
  Object[] row = new Object[1];
  row[0] = "TABLE";
  data.add(row);
  AvaticaResultSet resultSet = null;
  try {
    resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, new KylinEnumerator<Object[]>(data), ColumnMetaData.struct(tableTypeMeta)), this.conn.getTimeZone());
    KylinConnectionImpl.TROJAN.execute(resultSet);
  } catch (SQLException e) {
    logger.error(e.getLocalizedMessage(), e);
  }
  return resultSet;
}

代码示例来源:origin: KylinOLAP/Kylin

public ResultSet getColumns(String catalog, Pat schemaPattern, Pat tableNamePattern, Pat columnNamePattern) {
  logger.debug("Get columns with conn " + conn);
  MetaProject metaProject = conn.getMetaProject();
  if (null != metaProject) {
    final DataSet<MetaColumn> columns = metaProject.getMetaColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern);
    final NamedFieldGetter<MetaColumn> columnGetter = new NamedFieldGetter<MetaColumn>(MetaColumn.class, columns.getMeta(), "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "IS_GENERATEDCOLUMN");
    AvaticaResultSet resultSet = null;
    try {
      resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, null, columnGetter.structType) {
        @Override
        public Cursor createCursor() {
          return columnGetter.cursor(columns.getEnumerator());
        }
      }, this.conn.getTimeZone());
      KylinConnectionImpl.TROJAN.execute(resultSet);
    } catch (SQLException e) {
      logger.error(e.getLocalizedMessage(), e);
    }
    return resultSet;
  } else {
    return mockEmptyResultSet();
  }
}

代码示例来源:origin: KylinOLAP/Kylin

public ResultSet getTables(String catalog, Pat schemaPattern, Pat tableNamePattern, List<String> typeList) {
  logger.debug("Get tables with conn " + conn);
  MetaProject metaProject = conn.getMetaProject();
  if (null != metaProject) {
    final DataSet<MetaTable> tables = metaProject.getMetaTables(catalog, schemaPattern, tableNamePattern);
    final NamedFieldGetter<MetaTable> tableGetter = new NamedFieldGetter<MetaTable>(MetaTable.class, tables.getMeta(), "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "SELF_REFERENCING_COL_NAME", "REF_GENERATION");
    AvaticaResultSet resultSet = null;
    try {
      resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, null, tableGetter.structType) {
        @Override
        public Cursor createCursor() {
          return tableGetter.cursor(tables.getEnumerator());
        }
      }, this.conn.getTimeZone());
      KylinConnectionImpl.TROJAN.execute(resultSet);
    } catch (SQLException e) {
      logger.error(e.getLocalizedMessage(), e);
    }
    return resultSet;
  } else {
    return mockEmptyResultSet();
  }
}

代码示例来源:origin: KylinOLAP/Kylin

public ResultSet getSchemas(String catalog, Pat schemaPattern) {
  logger.debug("Get schemas with conn " + conn);
  MetaProject metaProject = conn.getMetaProject();
  if (null != metaProject) {
    final DataSet<MetaSchema> schemas = metaProject.getMetaSchemas(catalog, schemaPattern);
    final NamedFieldGetter<MetaSchema> schemaGetter = new NamedFieldGetter<MetaSchema>(MetaSchema.class, schemas.getMeta(), "TABLE_SCHEM", "TABLE_CATALOG");
    AvaticaResultSet resultSet = null;
    try {
      resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, null, schemaGetter.structType) {
        @Override
        public Cursor createCursor() {
          return schemaGetter.cursor(schemas.getEnumerator());
        }
      }, this.conn.getTimeZone());
      KylinConnectionImpl.TROJAN.execute(resultSet);
    } catch (SQLException e) {
      logger.error(e.getLocalizedMessage(), e);
    }
    return resultSet;
  } else {
    return mockEmptyResultSet();
  }
}

代码示例来源:origin: KylinOLAP/Kylin

public ResultSet getCatalogs() {
  MetaProject metaProject = conn.getMetaProject();
  if (null != metaProject) {
    final DataSet<MetaCatalog> catalogs = metaProject.getMetaCatalogs();
    final NamedFieldGetter<MetaCatalog> catalogGetter = new NamedFieldGetter<MetaCatalog>(MetaCatalog.class, catalogs.getMeta(), "TABLE_CATALOG");
    AvaticaResultSet resultSet = null;
    try {
      resultSet = this.conn.getFactory().newResultSet(this.conn.createStatement(), new KylinPrepare.PrepareResult(null, null, null, catalogGetter.structType) {
        @Override
        public Cursor createCursor() {
          return catalogGetter.cursor(catalogs.getEnumerator());
        }
      }, this.conn.getTimeZone());
      KylinConnectionImpl.TROJAN.execute(resultSet);
    } catch (SQLException e) {
      logger.error(e.getLocalizedMessage(), e);
    }
    return resultSet;
  } else {
    return mockEmptyResultSet();
  }
}

相关文章