Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/sql/SQLDataException.java
38829 views
/*1* Copyright (c) 2005, 2010, 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</code> may be thrown.35* @since 1.636*/37public class SQLDataException extends SQLNonTransientException {3839/**40* Constructs a <code>SQLDataException</code> object.41* The <code>reason</code>, <code>SQLState</code> are initialized42* to <code>null</code> and the vendor code is initialized to 0.43*44* The <code>cause</code> is not initialized, and may subsequently be45* initialized by a call to46* {@link Throwable#initCause(java.lang.Throwable)} method.47* <p>48*49* @since 1.650*/51public SQLDataException() {52super();53}5455/**56* Constructs a <code>SQLDataException</code> object with a given57* <code>reason</code>.58* The <code>SQLState</code> is initialized59* to <code>null</code> and the vendor code is initialized to 0.60*61* The <code>cause</code> is not initialized, and may subsequently be62* initialized by a call to63* {@link Throwable#initCause(java.lang.Throwable)} method.64* <p>65*66* @param reason a description of the exception67* @since 1.668*/69public SQLDataException(String reason) {70super(reason);71}7273/**74* Constructs a <code>SQLDataException</code> object with a given75* <code>reason</code> and <code>SQLState</code>. The76* vendor code is initialized to 0.77*78* The <code>cause</code> is not initialized, and may subsequently be79* initialized by a call to80* {@link Throwable#initCause(java.lang.Throwable)} method.81* <p>82* @param reason a description of the exception83* @param SQLState an XOPEN or SQL:2003 code identifying the exception84* @since 1.685*/86public SQLDataException(String reason, String SQLState) {87super(reason, SQLState);88}8990/**91* Constructs a <code>SQLDataException</code> object with a given92* <code>reason</code>, <code>SQLState</code> and93* <code>vendorCode</code>.94*95* The <code>cause</code> is not initialized, and may subsequently be96* initialized by a call to97* {@link Throwable#initCause(java.lang.Throwable)} method.98* <p>99* @param reason a description of the exception100* @param SQLState an XOPEN or SQL:2003 code identifying the exception101* @param vendorCode a database vendor specific exception code102* @since 1.6103*/104public SQLDataException(String reason, String SQLState, int vendorCode) {105super(reason, SQLState, vendorCode);106}107108/**109* Constructs a <code>SQLDataException</code> object with a given110* <code>cause</code>.111* The <code>SQLState</code> is initialized112* to <code>null</code> and the vendor code is initialized to 0.113* The <code>reason</code> is initialized to <code>null</code> if114* <code>cause==null</code> or to <code>cause.toString()</code> if115* <code>cause!=null</code>.116* <p>117* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating118* the cause is non-existent or unknown.119* @since 1.6120*/121public SQLDataException(Throwable cause) {122super(cause);123}124125/**126* Constructs a <code>SQLDataException</code> object with a given127* <code>reason</code> and <code>cause</code>.128* The <code>SQLState</code> is initialized to <code>null</code>129* and the vendor code is initialized to 0.130* <p>131* @param reason a description of the exception.132* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating133* the cause is non-existent or unknown.134* @since 1.6135*/136public SQLDataException(String reason, Throwable cause) {137super(reason, cause);138}139140/**141* Constructs a <code>SQLDataException</code> object with a given142* <code>reason</code>, <code>SQLState</code> and <code>cause</code>.143* The vendor code is initialized to 0.144* <p>145* @param reason a description of the exception.146* @param SQLState an XOPEN or SQL:2003 code identifying the exception147* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating148* the cause is non-existent or unknown.149* @since 1.6150*/151public SQLDataException(String reason, String SQLState, Throwable cause) {152super(reason, SQLState, cause);153}154155/**156* Constructs a <code>SQLDataException</code> object with a given157* <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>158* and <code>cause</code>.159* <p>160* @param reason a description of the exception161* @param SQLState an XOPEN or SQL:2003 code identifying the exception162* @param vendorCode a database vendor-specific exception code163* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating164* the cause is non-existent or unknown.165* @since 1.6166*/167public SQLDataException(String reason, String SQLState, int vendorCode, Throwable cause) {168super(reason, SQLState, vendorCode, cause);169}170171private static final long serialVersionUID = -6889123282670549800L;172}173174175