Save This Page
Home » openjdk-7 » java » sql » [javadoc | source]
    1   /*
    2    * Copyright 2005-2006 Sun Microsystems, Inc.  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.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package java.sql;
   27   
   28   /**
   29    * The subclass of {@link SQLException} thrown when the SQLState class value is '<i>22</i>'. This indicates
   30    * various data errors, including but not limited to not-allowed conversion, division by 0
   31    * and invalid arguments to functions.
   32    *
   33    * @since 1.6
   34    */
   35   public class SQLDataException extends SQLNonTransientException {
   36   
   37           /**
   38            * Constructs a <code>SQLDataException</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
   44            * {@link Throwable#initCause(java.lang.Throwable)} method.
   45            * <p>
   46            *
   47            * @since 1.6
   48            */
   49           public SQLDataException() {
   50                    super();
   51           }
   52   
   53           /**
   54            * Constructs a <code>SQLDataException</code> object with a given
   55            * <code>reason</code>.
   56            * The <code>SQLState</code> is initialized
   57            * to <code>null</code> and the vendor code is initialized to 0.
   58            *
   59            * The <code>cause</code> is not initialized, and may subsequently be
   60            * initialized by a call to
   61            * {@link Throwable#initCause(java.lang.Throwable)} method.
   62            * <p>
   63            *
   64            * @param reason a description of the exception
   65            * @since 1.6
   66            */
   67           public SQLDataException(String reason) {
   68                   super(reason);
   69           }
   70   
   71           /**
   72            * Constructs a <code>SQLDataException</code> object with a given
   73            * <code>reason</code> and <code>SQLState</code>. The
   74            * vendor code is initialized to 0.
   75            *
   76            * The <code>cause</code> is not initialized, and may subsequently be
   77            * initialized by a call to
   78            * {@link Throwable#initCause(java.lang.Throwable)} method.
   79            * <p>
   80            * @param reason a description of the exception
   81            * @param SQLState an XOPEN or SQL:2003 code identifying the exception
   82            * @since 1.6
   83            */
   84           public SQLDataException(String reason, String SQLState) {
   85                   super(reason, SQLState);
   86           }
   87   
   88           /**
   89            * Constructs a <code>SQLDataException</code> object with a given
   90            * <code>reason</code>, <code>SQLState</code>  and
   91            * <code>vendorCode</code>.
   92            *
   93            * The <code>cause</code> is not initialized, and may subsequently be
   94            * initialized by a call to
   95            * {@link Throwable#initCause(java.lang.Throwable)} method.
   96            * <p>
   97            * @param reason a description of the exception
   98            * @param SQLState an XOPEN or SQL:2003 code identifying the exception
   99            * @param vendorCode a database vendor specific exception code
  100            * @since 1.6
  101            */
  102           public SQLDataException(String reason, String SQLState, int vendorCode) {
  103                    super(reason, SQLState, vendorCode);
  104           }
  105   
  106       /**
  107        * Constructs a <code>SQLDataException</code> object with a given
  108        * <code>cause</code>.
  109        * The <code>SQLState</code> is initialized
  110        * to <code>null</code> and the vendor code is initialized to 0.
  111        * The <code>reason</code>  is initialized to <code>null</code> if
  112        * <code>cause==null</code> or to <code>cause.toString()</code> if
  113        * <code>cause!=null</code>.
  114        * <p>
  115        * @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
  116        *     the cause is non-existent or unknown.
  117        * @since 1.6
  118            */
  119       public SQLDataException(Throwable cause) {
  120           super(cause);
  121       }
  122   
  123       /**
  124        * Constructs a <code>SQLDataException</code> object 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        */
  134       public SQLDataException(String reason, Throwable cause) {
  135            super(reason, cause);
  136       }
  137   
  138       /**
  139        *  Constructs a <code>SQLDataException</code> object 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        */
  149       public SQLDataException(String reason, String SQLState, Throwable cause) {
  150           super(reason, SQLState, cause);
  151       }
  152   
  153       /**
  154        * Constructs a <code>SQLDataException</code> object with a given
  155        * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
  156        * and  <code>cause</code>.
  157        * <p>
  158        * @param reason a description of the exception
  159        * @param SQLState an XOPEN or SQL:2003 code identifying the exception
  160        * @param vendorCode a database vendor-specific exception code
  161        * @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
  162        *     the cause is non-existent or unknown.
  163        * @since 1.6
  164        */
  165       public SQLDataException(String reason, String SQLState, int vendorCode, Throwable cause) {
  166             super(reason, SQLState, vendorCode, cause);
  167       }
  168   
  169      private static final long serialVersionUID = -6889123282670549800L;
  170   }

Save This Page
Home » openjdk-7 » java » sql » [javadoc | source]