Tabnine Logo
DbException.getSQLException
Code IndexAdd Tabnine to your IDE (free)

How to use
getSQLException
method
in
org.h2.message.DbException

Best Java code snippets using org.h2.message.DbException.getSQLException (Showing top 20 results out of 315)

origin: com.h2database/h2

/**
 * Get the error code.
 *
 * @return the error code
 */
public int getErrorCode() {
  return getSQLException().getErrorCode();
}
origin: com.h2database/h2

/**
 * INTERNAL
 */
static SQLException getUnsupportedException() {
  return DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1).
      getSQLException();
}
origin: com.h2database/h2

/**
 * Throw a SQLException saying this command line option is not supported.
 *
 * @param option the unsupported option
 * @return this method never returns normally
 */
protected SQLException throwUnsupportedOption(String option)
    throws SQLException {
  throw DbException.get(
      ErrorCode.FEATURE_NOT_SUPPORTED_1, option).getSQLException();
}
origin: com.h2database/h2

/**
 * Convert an exception to a SQL exception using the default mapping.
 *
 * @param e the root cause
 * @return the SQL exception object
 */
public static SQLException toSQLException(Throwable e) {
  if (e instanceof SQLException) {
    return (SQLException) e;
  }
  return convert(e).getSQLException();
}
origin: com.h2database/h2

private void checkColumnIndex(int columnIndex) throws SQLException {
  if (columnIndex < 1 || columnIndex > columns.size()) {
    throw DbException.getInvalidValueException(
        "columnIndex", columnIndex).getSQLException();
  }
}
origin: com.h2database/h2

private static SQLException convertException(String message, Exception e) {
  return DbException.get(ErrorCode.IO_EXCEPTION_1, e, message).getSQLException();
}
origin: com.h2database/h2

private Object get(int columnIndex) throws SQLException {
  if (currentRow == null) {
    throw DbException.get(ErrorCode.NO_DATA_AVAILABLE).
        getSQLException();
  }
  checkColumnIndex(columnIndex);
  columnIndex--;
  Object o = columnIndex < currentRow.length ?
      currentRow[columnIndex] : null;
  wasNull = o == null;
  return o;
}
origin: com.h2database/h2

/**
 * Searches for a specific column in the result set. A case-insensitive
 * search is made.
 *
 * @param columnLabel the column label
 * @return the column index (1,2,...)
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public int findColumn(String columnLabel) throws SQLException {
  if (columnLabel != null && columns != null) {
    for (int i = 0, size = columns.size(); i < size; i++) {
      if (columnLabel.equalsIgnoreCase(getColumn(i).name)) {
        return i + 1;
      }
    }
  }
  throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel)
      .getSQLException();
}
origin: com.h2database/h2

/**
 * Set the SQL statement of the given exception.
 * This method may create a new object.
 *
 * @param sql the SQL statement
 * @return the exception
 */
public DbException addSQL(String sql) {
  SQLException e = getSQLException();
  if (e instanceof JdbcSQLException) {
    JdbcSQLException j = (JdbcSQLException) e;
    if (j.getSQL() == null) {
      j.setSQL(sql);
    }
    return this;
  }
  e = new JdbcSQLException(e.getMessage(), sql, e.getSQLState(),
      e.getErrorCode(), e, null);
  return new DbException(e);
}
origin: com.h2database/h2

  if (!rs.next()) {
    throw DbException.get(ErrorCode.IO_EXCEPTION_1,
        "Missing lob entry: " + lobId).getSQLException();
if (lobMapCount == 0) {
  throw DbException.get(ErrorCode.IO_EXCEPTION_1,
      "Missing lob entry: " + lobId).getSQLException();
origin: com.h2database/h2

throw DbException.get(ErrorCode.IO_EXCEPTION_1,
    "Missing lob entry, block: " + block)
    .getSQLException();
origin: com.h2database/h2

throw DbException.get(
    ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1,
    message).getSQLException();
throw DbException.get(
    ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, e,
    message).getSQLException();
origin: com.h2database/h2

int errorCode = 0;
if (e instanceof DbException) {
  e = ((DbException) e).getSQLException();
  errorCode = ((SQLException) e).getErrorCode();
origin: com.h2database/h2

private void sendError(Throwable t) {
  try {
    SQLException e = DbException.convert(t).getSQLException();
    StringWriter writer = new StringWriter();
    e.printStackTrace(new PrintWriter(writer));
    String trace = writer.toString();
    String message;
    String sql;
    if (e instanceof JdbcSQLException) {
      JdbcSQLException j = (JdbcSQLException) e;
      message = j.getOriginalMessage();
      sql = j.getSQL();
    } else {
      message = e.getMessage();
      sql = null;
    }
    transfer.writeInt(SessionRemote.STATUS_ERROR).
        writeString(e.getSQLState()).writeString(message).
        writeString(sql).writeInt(e.getErrorCode()).writeString(trace).flush();
  } catch (Exception e2) {
    if (!transfer.isClosed()) {
      server.traceError(e2);
    }
    // if writing the error does not work, close the connection
    stop = true;
  }
}
origin: com.h2database/h2

/**
 * Execute the meta data statement.
 *
 * @param db the database
 * @param systemSession the system session
 * @param listener the database event listener
 */
void execute(Database db, Session systemSession,
    DatabaseEventListener listener) {
  try {
    Prepared command = systemSession.prepare(sql);
    command.setObjectId(id);
    command.update();
  } catch (DbException e) {
    e = e.addSQL(sql);
    SQLException s = e.getSQLException();
    db.getTrace(Trace.DATABASE).error(s, sql);
    if (listener != null) {
      listener.exceptionThrown(s, sql);
      // continue startup in this case
    } else {
      throw e;
    }
  }
}
origin: com.h2database/h2

if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) {
  if (autoServerMode) {
    String serverKey = ((JdbcSQLException) e.getSQLException()).
        getSQL();
    if (serverKey != null) {
origin: com.h2database/h2

} catch (DbException e) {
  if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF
      && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) {
origin: com.h2database/h2

SQLException s = e.getSQLException();
database.exceptionThrown(s, sql);
if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) {
origin: com.h2database/h2

SQLException s = e.getSQLException();
database.exceptionThrown(s, sql);
if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) {
origin: com.eventsourcing/h2

/**
 * INTERNAL
 */
static SQLException getUnsupportedException() {
  return DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1).
      getSQLException();
}
org.h2.messageDbExceptiongetSQLException

Javadoc

Get the SQLException object.

Popular methods of DbException

  • getUnsupportedException
    Gets a SQL exception meaning this feature is not supported.
  • throwInternalError
    Throw an internal error. This method seems to return an exception object, so that it can be used ins
  • convert
    Convert a throwable to an SQL exception using the default mapping. All errors except the following a
  • get
    Create a database exception for a specific error code.
  • <init>
  • addSQL
    Set the SQL statement of the given exception. This method may create a new object.
  • convertIOException
    Convert an IO exception to a database exception.
  • convertInvocation
    Convert an InvocationTarget exception to a database exception.
  • convertToIOException
    Convert an exception to an IO exception.
  • getCause
  • getErrorCode
    Get the error code.
  • getInvalidValueException
    Gets a SQL exception meaning this value is invalid.
  • getErrorCode,
  • getInvalidValueException,
  • getJdbcSQLException,
  • getMessage,
  • getSource,
  • getSyntaxError,
  • printStackTrace,
  • setSource,
  • toSQLException

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • setContentView (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now