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