Path: blob/master/src/java.sql/share/classes/java/sql/SQLDataException.java
41153 views
/*1* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.sql;2627/**28* The subclass of {@link SQLException} thrown when the SQLState class value29* is '<i>22</i>', or under vendor-specified conditions. This indicates30* various data errors, including but not limited to data conversion errors,31* division by 0, and invalid arguments to functions.32* <p>33* Please consult your driver vendor documentation for the vendor-specified34* conditions for which this {@code Exception} may be thrown.35* @since 1.636*/37public class SQLDataException extends SQLNonTransientException {3839/**40* Constructs a {@code SQLDataException} object.41* The {@code reason}, {@code SQLState} are initialized42* to {@code null} and the vendor code is initialized to 0.43*44* The {@code cause} is not initialized, and may subsequently be45* initialized by a call to46* {@link Throwable#initCause(java.lang.Throwable)} method.47*48* @since 1.649*/50public SQLDataException() {51super();52}5354/**55* Constructs a {@code SQLDataException} object with a given56* {@code reason}.57* The {@code SQLState} is initialized58* to {@code null} and the vendor code is initialized to 0.59*60* The {@code cause} is not initialized, and may subsequently be61* initialized by a call to62* {@link Throwable#initCause(java.lang.Throwable)} method.63*64* @param reason a description of the exception65* @since 1.666*/67public SQLDataException(String reason) {68super(reason);69}7071/**72* Constructs a {@code SQLDataException} object with a given73* {@code reason} and {@code SQLState}. The74* vendor code is initialized to 0.75*76* The {@code cause} is not initialized, and may subsequently be77* initialized by a call to78* {@link Throwable#initCause(java.lang.Throwable)} method.79*80* @param reason a description of the exception81* @param SQLState an XOPEN or SQL:2003 code identifying the exception82* @since 1.683*/84public SQLDataException(String reason, String SQLState) {85super(reason, SQLState);86}8788/**89* Constructs a {@code SQLDataException} object with a given90* {@code reason}, {@code SQLState} and91* {@code vendorCode}.92*93* The {@code cause} is not initialized, and may subsequently be94* initialized by a call to95* {@link Throwable#initCause(java.lang.Throwable)} method.96*97* @param reason a description of the exception98* @param SQLState an XOPEN or SQL:2003 code identifying the exception99* @param vendorCode a database vendor specific exception code100* @since 1.6101*/102public SQLDataException(String reason, String SQLState, int vendorCode) {103super(reason, SQLState, vendorCode);104}105106/**107* Constructs a {@code SQLDataException} object with a given108* {@code cause}.109* The {@code SQLState} is initialized110* to {@code null} and the vendor code is initialized to 0.111* The {@code reason} is initialized to {@code null} if112* {@code cause==null} or to {@code cause.toString()} if113* {@code cause!=null}.114*115* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating116* the cause is non-existent or unknown.117* @since 1.6118*/119public SQLDataException(Throwable cause) {120super(cause);121}122123/**124* Constructs a {@code SQLDataException} object with a given125* {@code reason} and {@code cause}.126* The {@code SQLState} is initialized to {@code null}127* and the vendor code is initialized to 0.128*129* @param reason a description of the exception.130* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating131* the cause is non-existent or unknown.132* @since 1.6133*/134public SQLDataException(String reason, Throwable cause) {135super(reason, cause);136}137138/**139* Constructs a {@code SQLDataException} object with a given140* {@code reason}, {@code SQLState} and {@code cause}.141* The vendor code is initialized to 0.142*143* @param reason a description of the exception.144* @param SQLState an XOPEN or SQL:2003 code identifying the exception145* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating146* the cause is non-existent or unknown.147* @since 1.6148*/149public SQLDataException(String reason, String SQLState, Throwable cause) {150super(reason, SQLState, cause);151}152153/**154* Constructs a {@code SQLDataException} object with a given155* {@code reason}, {@code SQLState}, {@code vendorCode}156* and {@code cause}.157*158* @param reason a description of the exception159* @param SQLState an XOPEN or SQL:2003 code identifying the exception160* @param vendorCode a database vendor-specific exception code161* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating162* the cause is non-existent or unknown.163* @since 1.6164*/165public SQLDataException(String reason, String SQLState, int vendorCode, Throwable cause) {166super(reason, SQLState, vendorCode, cause);167}168169private static final long serialVersionUID = -6889123282670549800L;170}171172173