001 /*
002 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.sql;
027
028 /**
029 * The subclass of {@link SQLException} thrown when the SQLState class value is '<i>42</i>'. This indicates that the
030 * in-progress query has violated SQL syntax rules.
031 *
032 * @since 1.6
033 */
034 public class SQLSyntaxErrorException extends SQLNonTransientException {
035
036 /**
037 * Constructs a <code>SQLSyntaxErrorException</code> object.
038 * The <code>reason</code>, <code>SQLState</code> are initialized
039 * to <code>null</code> and the vendor code is initialized to 0.
040 *
041 * The <code>cause</code> is not initialized, and may subsequently be
042 * initialized by a call to the
043 * {@link Throwable#initCause(java.lang.Throwable)} method.
044 * <p>
045 * @since 1.6
046 */
047 public SQLSyntaxErrorException() {
048 super ();
049 }
050
051 /**
052 * Constructs a <code>SQLSyntaxErrorException</code> object
053 * with a given <code>reason</code>. The <code>SQLState</code>
054 * is initialized to <code>null</code> and the vender code is initialized
055 * to 0.
056 *
057 * The <code>cause</code> is not initialized, and may subsequently be
058 * initialized by a call to the
059 * {@link Throwable#initCause(java.lang.Throwable)} method.
060 * <p>
061 * @param reason a description of the exception
062 * @since 1.6
063 */
064 public SQLSyntaxErrorException(String reason) {
065 super (reason);
066 }
067
068 /**
069 * Constructs a <code>SQLSyntaxErrorException</code> object
070 * with a given <code>reason</code> and <code>SQLState</code>.
071 *
072 * The <code>cause</code> is not initialized, and may subsequently be
073 * initialized by a call to the
074 * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
075 * is initialized to 0.
076 * <p>
077 * @param reason a description of the exception
078 * @param SQLState an XOPEN or SQL:2003 code identifying the exception
079 * @since 1.6
080 */
081 public SQLSyntaxErrorException(String reason, String SQLState) {
082 super (reason, SQLState);
083 }
084
085 /**
086 * Constructs a <code>SQLSyntaxErrorException</code> object
087 * with a given <code>reason</code>, <code>SQLState</code> and
088 * <code>vendorCode</code>.
089 *
090 * The <code>cause</code> is not initialized, and may subsequently be
091 * initialized by a call to the
092 * {@link Throwable#initCause(java.lang.Throwable)} method.
093 * <p>
094 * @param reason a description of the exception
095 * @param SQLState an XOPEN or SQL:2003 code identifying the exception
096 * @param vendorCode a database vendor specific exception code
097 * @since 1.6
098 */
099 public SQLSyntaxErrorException(String reason, String SQLState,
100 int vendorCode) {
101 super (reason, SQLState, vendorCode);
102 }
103
104 /**
105 * Constructs a <code>SQLSyntaxErrorException</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 bythe <code>getCause()</code> method); may be null indicating
114 * the cause is non-existent or unknown.
115 * @since 1.6
116 */
117 public SQLSyntaxErrorException(Throwable cause) {
118 super (cause);
119 }
120
121 /**
122 * Constructs a <code>SQLSyntaxErrorException</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 */
133 public SQLSyntaxErrorException(String reason, Throwable cause) {
134 super (reason, cause);
135 }
136
137 /**
138 * Constructs a <code>SQLSyntaxErrorException</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 (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 */
149 public SQLSyntaxErrorException(String reason, String SQLState,
150 Throwable cause) {
151 super (reason, SQLState, cause);
152 }
153
154 /**
155 * Constructs a <code>SQLSyntaxErrorException</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 */
167 public SQLSyntaxErrorException(String reason, String SQLState,
168 int vendorCode, Throwable cause) {
169 super (reason, SQLState, vendorCode, cause);
170 }
171
172 private static final long serialVersionUID = -1843832610477496053L;
173 }
|