Source Code Cross Referenced for SQLWarning.java in  » 6.0-JDK-Core » sql » java » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sql » java.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1996-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         * <P>An exception that provides information on  database access
030         * warnings. Warnings are silently chained to the object whose method
031         * caused it to be reported.  
032         * <P>
033         * Warnings may be retrieved from <code>Connection</code>, <code>Statement</code>,
034         * and <code>ResultSet</code> objects.  Trying to retrieve a warning on a
035         * connection after it has been closed will cause an exception to be thrown.
036         * Similarly, trying to retrieve a warning on a statement after it has been
037         * closed or on a result set after it has been closed will cause 
038         * an exception to be thrown. Note that closing a statement also 
039         * closes a result set that it might have produced.
040         *
041         * @see Connection#getWarnings
042         * @see Statement#getWarnings
043         * @see ResultSet#getWarnings 
044         */
045        public class SQLWarning extends SQLException {
046
047            /**
048             * Constructs a  <code>SQLWarning</code> object
049             *  with a given <code>reason</code>, <code>SQLState</code>  and 
050             * <code>vendorCode</code>.
051             *
052             * The <code>cause</code> is not initialized, and may subsequently be
053             * initialized by a call to the 
054             * {@link Throwable#initCause(java.lang.Throwable)} method.
055             * <p>
056             * @param reason a description of the warning 
057             * @param SQLState an XOPEN or SQL:2003 code identifying the warning
058             * @param vendorCode a database vendor-specific warning code
059             */
060            public SQLWarning(String reason, String SQLState, int vendorCode) {
061                super (reason, SQLState, vendorCode);
062                DriverManager.println("SQLWarning: reason(" + reason
063                        + ") SQLState(" + SQLState + ") vendor code("
064                        + vendorCode + ")");
065            }
066
067            /**
068             * Constructs a <code>SQLWarning</code> object
069             * with a given <code>reason</code> and <code>SQLState</code>.
070             *
071             * The <code>cause</code> is not initialized, and may subsequently be
072             * initialized by a call to the 
073             * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
074             * is initialized to 0.
075             * <p>
076             * @param reason a description of the warning 
077             * @param SQLState an XOPEN or SQL:2003 code identifying the warning
078             */
079            public SQLWarning(String reason, String SQLState) {
080                super (reason, SQLState);
081                DriverManager.println("SQLWarning: reason(" + reason
082                        + ") SQLState(" + SQLState + ")");
083            }
084
085            /**
086             * Constructs a <code>SQLWarning</code> object
087             * with a given <code>reason</code>. The <code>SQLState</code> 
088             * is initialized to <code>null</code> and the vender code is initialized 
089             * to 0.
090             *
091             * The <code>cause</code> is not initialized, and may subsequently be
092             * initialized by a call to the 
093             * {@link Throwable#initCause(java.lang.Throwable)} method.
094             * <p>
095             * @param reason a description of the warning 
096             */
097            public SQLWarning(String reason) {
098                super (reason);
099                DriverManager.println("SQLWarning: reason(" + reason + ")");
100            }
101
102            /**
103             * Constructs a  <code>SQLWarning</code> object.
104             * The <code>reason</code>, <code>SQLState</code> are initialized
105             * to <code>null</code> and the vendor code is initialized to 0.
106             *
107             * The <code>cause</code> is not initialized, and may subsequently be
108             * initialized by a call to the 
109             * {@link Throwable#initCause(java.lang.Throwable)} method.
110             * <p>
111             */
112            public SQLWarning() {
113                super ();
114                DriverManager.println("SQLWarning: ");
115            }
116
117            /**
118             * Constructs a <code>SQLWarning</code> object
119             * with a given  <code>cause</code>.
120             * The <code>SQLState</code> is initialized
121             * to <code>null</code> and the vendor code is initialized to 0. 
122             * The <code>reason</code>  is initialized to <code>null</code> if 
123             * <code>cause==null</code> or to <code>cause.toString()</code> if 
124             * <code>cause!=null</code>.
125             * <p>
126             * @param cause the underlying reason for this <code>SQLWarning</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
127             *     the cause is non-existent or unknown.
128             */
129            public SQLWarning(Throwable cause) {
130                super (cause);
131                DriverManager.println("SQLWarning");
132            }
133
134            /**
135             * Constructs a <code>SQLWarning</code> object
136             * with a given
137             * <code>reason</code> and  <code>cause</code>.  
138             * The <code>SQLState</code> is  initialized to <code>null</code>
139             * and the vendor code is initialized to 0.
140             * <p>
141             * @param reason a description of the warning
142             * @param cause  the underlying reason for this <code>SQLWarning</code> 
143             * (which is saved for later retrieval by the <code>getCause()</code> method);
144             * may be null indicating the cause is non-existent or unknown.
145             */
146            public SQLWarning(String reason, Throwable cause) {
147                super (reason, cause);
148                DriverManager.println("SQLWarning : reason(" + reason + ")");
149            }
150
151            /**
152             * Constructs a <code>SQLWarning</code> object
153             * with a given
154             * <code>reason</code>, <code>SQLState</code> and  <code>cause</code>.  
155             * The vendor code is initialized to 0.
156             * <p>
157             * @param reason a description of the warning
158             * @param SQLState an XOPEN or SQL:2003 code identifying the warning
159             * @param cause the underlying reason for this <code>SQLWarning</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
160             *     the cause is non-existent or unknown.
161             */
162            public SQLWarning(String reason, String SQLState, Throwable cause) {
163                super (reason, SQLState, cause);
164                DriverManager.println("SQLWarning: reason(" + reason
165                        + ") SQLState(" + SQLState + ")");
166            }
167
168            /**
169             * Constructs a<code>SQLWarning</code> object
170             * with a given
171             * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
172             * and  <code>cause</code>.  
173             * <p>
174             * @param reason a description of the warning
175             * @param SQLState an XOPEN or SQL:2003 code identifying the warning
176             * @param vendorCode a database vendor-specific warning code
177             * @param cause the underlying reason for this <code>SQLWarning</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
178             *     the cause is non-existent or unknown.
179             */
180            public SQLWarning(String reason, String SQLState, int vendorCode,
181                    Throwable cause) {
182                super (reason, SQLState, vendorCode, cause);
183                DriverManager.println("SQLWarning: reason(" + reason
184                        + ") SQLState(" + SQLState + ") vendor code("
185                        + vendorCode + ")");
186
187            }
188
189            /**
190             * Retrieves the warning chained to this <code>SQLWarning</code> object by
191             * <code>setNextWarning</code>.
192             *
193             * @return the next <code>SQLException</code> in the chain; <code>null</code> if none
194             * @see #setNextWarning
195             */
196            public SQLWarning getNextWarning() {
197                try {
198                    return ((SQLWarning) getNextException());
199                } catch (ClassCastException ex) {
200                    // The chained value isn't a SQLWarning.
201                    // This is a programming error by whoever added it to
202                    // the SQLWarning chain.  We throw a Java "Error".
203                    throw new Error(
204                            "SQLWarning chain holds value that is not a SQLWarning");
205                }
206            }
207
208            /**
209             * Adds a <code>SQLWarning</code> object to the end of the chain.
210             *
211             * @param w the new end of the <code>SQLException</code> chain
212             * @see #getNextWarning
213             */
214            public void setNextWarning(SQLWarning w) {
215                setNextException(w);
216            }
217
218            private static final long serialVersionUID = 3917336774604784856L;
219        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.