1 /* 2 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.sql; 27 28 import java.util.Iterator; 29 import java.util.NoSuchElementException; 30 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; 31 32 /** 33 * <P>An exception that provides information on a database access 34 * error or other errors. 35 * 36 * <P>Each <code>SQLException</code> provides several kinds of information: 37 * <UL> 38 * <LI> a string describing the error. This is used as the Java Exception 39 * message, available via the method <code>getMesasge</code>. 40 * <LI> a "SQLstate" string, which follows either the XOPEN SQLstate conventions 41 * or the SQL:2003 conventions. 42 * The values of the SQLState string are described in the appropriate spec. 43 * The <code>DatabaseMetaData</code> method <code>getSQLStateType</code> 44 * can be used to discover whether the driver returns the XOPEN type or 45 * the SQL:2003 type. 46 * <LI> an integer error code that is specific to each vendor. Normally this will 47 * be the actual error code returned by the underlying database. 48 * <LI> a chain to a next Exception. This can be used to provide additional 49 * error information. 50 * <LI> the causal relationship, if any for this <code>SQLException</code>. 51 * </UL> 52 */ 53 public class SQLException extends java.lang.Exception 54 implements Iterable<Throwable> { 55 56 /** 57 * Constructs a <code>SQLException</code> object with a given 58 * <code>reason</code>, <code>SQLState</code> and 59 * <code>vendorCode</code>. | 1 /* 2 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.sql; 27 28 import java.util.Iterator; 29 import java.util.NoSuchElementException; 30 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; 31 32 /** 33 * <P>An exception that provides information on a database access 34 * error or other errors. 35 * 36 * <P>Each <code>SQLException</code> provides several kinds of information: 37 * <UL> 38 * <LI> a string describing the error. This is used as the Java Exception 39 * message, available via the method <code>getMessage</code>. 40 * <LI> a "SQLstate" string, which follows either the XOPEN SQLstate conventions 41 * or the SQL:2003 conventions. 42 * The values of the SQLState string are described in the appropriate spec. 43 * The <code>DatabaseMetaData</code> method <code>getSQLStateType</code> 44 * can be used to discover whether the driver returns the XOPEN type or 45 * the SQL:2003 type. 46 * <LI> an integer error code that is specific to each vendor. Normally this will 47 * be the actual error code returned by the underlying database. 48 * <LI> a chain to a next Exception. This can be used to provide additional 49 * error information. 50 * <LI> the causal relationship, if any for this <code>SQLException</code>. 51 * </UL> 52 */ 53 public class SQLException extends java.lang.Exception 54 implements Iterable<Throwable> { 55 56 /** 57 * Constructs a <code>SQLException</code> object with a given 58 * <code>reason</code>, <code>SQLState</code> and 59 * <code>vendorCode</code>. |