1 /* 2 * Copyright (c) 2005, 2006, 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 /** 29 * <P>The subclass of {@link SQLException} thrown when the timeout specified by <code>Statement</code> 30 * has expired. 31 * <P> This exception does not correspond to a standard SQLState. 32 * 33 * @since 1.6 34 */ 35 36 public class SQLTimeoutException extends SQLTransientException { 37 /** 38 * Constructs a <code>SQLTimeoutException</code> object. 39 * The <code>reason</code>, <code>SQLState</code> are initialized 40 * to <code>null</code> and the vendor code is initialized to 0. 41 * 42 * The <code>cause</code> is not initialized, and may subsequently be 43 * initialized by a call to the 44 * {@link Throwable#initCause(java.lang.Throwable)} method. 45 * <p> 46 * @since 1.6 47 */ SQLTimeoutException()48 public SQLTimeoutException() { 49 super(); 50 } 51 52 /** 53 * Constructs a <code>SQLTimeoutException</code> object 54 * with a given <code>reason</code>. The <code>SQLState</code> 55 * is initialized to <code>null</code> and the vender code is initialized 56 * to 0. 57 * 58 * The <code>cause</code> is not initialized, and may subsequently be 59 * initialized by a call to the 60 * {@link Throwable#initCause(java.lang.Throwable)} method. 61 * <p> 62 * @param reason a description of the exception 63 * @since 1.6 64 */ SQLTimeoutException(String reason)65 public SQLTimeoutException(String reason) { 66 super(reason); 67 } 68 69 /** 70 * Constructs a <code>SQLTimeoutException</code> object 71 * with a given <code>reason</code> and <code>SQLState</code>. 72 * 73 * The <code>cause</code> is not initialized, and may subsequently be 74 * initialized by a call to the 75 * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code 76 * is initialized to 0. 77 * <p> 78 * @param reason a description of the exception 79 * @param SQLState an XOPEN or SQL:2003 code identifying the exception 80 * @since 1.6 81 */ SQLTimeoutException(String reason, String SQLState)82 public SQLTimeoutException(String reason, String SQLState) { 83 super(reason, SQLState); 84 } 85 86 /** 87 * Constructs a <code>SQLTimeoutException</code> object 88 * with a given <code>reason</code>, <code>SQLState</code> and 89 * <code>vendorCode</code>. 90 * 91 * The <code>cause</code> is not initialized, and may subsequently be 92 * initialized by a call to the 93 * {@link Throwable#initCause(java.lang.Throwable)} method. 94 * <p> 95 * @param reason a description of the exception 96 * @param SQLState an XOPEN or SQL:2003 code identifying the exception 97 * @param vendorCode a database vendor specific exception code 98 * @since 1.6 99 */ SQLTimeoutException(String reason, String SQLState, int vendorCode)100 public SQLTimeoutException(String reason, String SQLState, int vendorCode) { 101 super(reason, SQLState, vendorCode); 102 } 103 104 /** 105 * Constructs a <code>SQLTimeoutException</code> object 106 * with a given <code>cause</code>. 107 * The <code>SQLState</code> is initialized 108 * to <code>null</code> and the vendor code is initialized to 0. 109 * The <code>reason</code> is initialized to <code>null</code> if 110 * <code>cause==null</code> or to <code>cause.toString()</code> if 111 * <code>cause!=null</code>. 112 * <p> 113 * @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 indicating 114 * the cause is non-existent or unknown. 115 * @since 1.6 116 */ SQLTimeoutException(Throwable cause)117 public SQLTimeoutException(Throwable cause) { 118 super(cause); 119 } 120 121 /** 122 * Constructs a <code>SQLTimeoutException</code> object 123 * with a given 124 * <code>reason</code> and <code>cause</code>. 125 * The <code>SQLState</code> is initialized to <code>null</code> 126 * and the vendor code is initialized to 0. 127 * <p> 128 * @param reason a description of the exception. 129 * @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 indicating 130 * the cause is non-existent or unknown. 131 * @since 1.6 132 */ SQLTimeoutException(String reason, Throwable cause)133 public SQLTimeoutException(String reason, Throwable cause) { 134 super(reason, cause); 135 } 136 137 /** 138 * Constructs a <code>SQLTimeoutException</code> object 139 * with a given 140 * <code>reason</code>, <code>SQLState</code> and <code>cause</code>. 141 * The vendor code is initialized to 0. 142 * <p> 143 * @param reason a description of the exception. 144 * @param SQLState an XOPEN or SQL:2003 code identifying the exception 145 * @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 indicating 146 * the cause is non-existent or unknown. 147 * @since 1.6 148 */ SQLTimeoutException(String reason, String SQLState, Throwable cause)149 public SQLTimeoutException(String reason, String SQLState, Throwable cause) { 150 super(reason, SQLState, cause); 151 } 152 153 /** 154 * Constructs a <code>SQLTimeoutException</code> object 155 * with a given 156 * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code> 157 * and <code>cause</code>. 158 * <p> 159 * @param reason a description of the exception 160 * @param SQLState an XOPEN or SQL:2003 code identifying the exception 161 * @param vendorCode a database vendor-specific exception code 162 * @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 indicating 163 * the cause is non-existent or unknown. 164 * @since 1.6 165 */ SQLTimeoutException(String reason, String SQLState, int vendorCode, Throwable cause)166 public SQLTimeoutException(String reason, String SQLState, int vendorCode, Throwable cause) { 167 super(reason, SQLState, vendorCode, cause); 168 } 169 170 private static final long serialVersionUID = -4487171280562520262L; 171 } 172