Here you can find the source of extractErrorCode(SQLException sqlException)
Parameter | Description |
---|---|
sqlException | The exception from which to extract the SQLState |
public static int extractErrorCode(SQLException sqlException)
//package com.java2s; //License from project: Apache License import java.sql.SQLException; public class Main { /**/*from ww w . j a v a 2 s . co m*/ * For the given SQLException, locates the vendor-specific error code. * * @param sqlException * The exception from which to extract the SQLState * @return The error code. */ public static int extractErrorCode(SQLException sqlException) { int errorCode = sqlException.getErrorCode(); SQLException nested = sqlException.getNextException(); while (errorCode == 0 && nested != null) { errorCode = nested.getErrorCode(); nested = nested.getNextException(); } return errorCode; } }