Source Code Cross Referenced for BatchUpdateException.java in  » Apache-Harmony-Java-SE » java-package » java » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package java.sql;
019:
020:        import java.io.Serializable;
021:
022:        /**
023:         * An exception thrown if a problem occurs during a batch update operation.
024:         * <p>
025:         * A BatchUpdateException provides additional information about the problem that
026:         * occurred, compared with a standard SQLException. It supplies update counts
027:         * for successful commands that executed within the batch update, but before the
028:         * exception was encountered.
029:         * <p>
030:         * The element order in the array of update counts matches the order that the
031:         * commands were added to the batch operation.
032:         * <p>
033:         * Once a batch update command fails and a BatchUpdateException is thrown, the
034:         * JDBC driver may continue processing the remaining commands in the batch. If
035:         * the driver does process more commands after the problem occurs, the array
036:         * returned by BatchUpdateException.getUpdateCounts has an element for every
037:         * command in the batch, not only those that executed successfully. In this
038:         * case, the array element for any command which encountered a problem is set to
039:         * Statement.EXECUTE_FAILED.
040:         */
041:        public class BatchUpdateException extends SQLException implements 
042:                Serializable {
043:
044:            private static final long serialVersionUID = 5977529877145521757L;
045:
046:            private int[] updateCounts = null;
047:
048:            /**
049:             * Creates a BatchUpdateException with the Reason, SQLState, and Update
050:             * Counts set to null and a Vendor Code of 0.
051:             */
052:            public BatchUpdateException() {
053:                super ();
054:            }
055:
056:            /**
057:             * Creates a BatchUpdateException with the Update Counts set to the supplied
058:             * value and the Reason, SQLState set to null and a Vendor Code of 0.
059:             * 
060:             * @param updateCounts
061:             *            the array of Update Counts to use in initialization
062:             */
063:            public BatchUpdateException(int[] updateCounts) {
064:                super ();
065:                this .updateCounts = updateCounts;
066:            }
067:
068:            /**
069:             * Creates a BatchUpdateException with the Update Counts set to the supplied
070:             * value, the Reason set to the supplied value and SQLState set to null and
071:             * a Vendor Code of 0.
072:             * 
073:             * @param reason
074:             *            the initialization value for Reason
075:             * @param updateCounts
076:             *            the array of Update Counts to set
077:             */
078:            public BatchUpdateException(String reason, int[] updateCounts) {
079:                super (reason);
080:                this .updateCounts = updateCounts;
081:            }
082:
083:            /**
084:             * Creates a BatchUpdateException with the Update Counts set to the supplied
085:             * value, the Reason set to the supplied value, the SQLState initialized to
086:             * the supplied value and the Vendor Code initialized to 0.
087:             * 
088:             * @param reason
089:             *            the value to use for the Reason
090:             * @param SQLState
091:             *            the X/OPEN value to use for the SQLState
092:             * @param updateCounts
093:             *            the array of Update Counts to set
094:             */
095:            public BatchUpdateException(String reason, String SQLState,
096:                    int[] updateCounts) {
097:                super (reason, SQLState);
098:                this .updateCounts = updateCounts;
099:            }
100:
101:            /**
102:             * Creates a BatchUpdateException with the Update Counts set to the supplied
103:             * value, the Reason set to the supplied value, the SQLState initialized to
104:             * the supplied value and the Vendor Code set to the supplied value.
105:             * 
106:             * @param reason
107:             *            the value to use for the Reason
108:             * @param SQLState
109:             *            the X/OPEN value to use for the SQLState
110:             * @param vendorCode
111:             *            the value to use for the vendor error code
112:             * @param updateCounts
113:             *            the array of Update Counts to set
114:             */
115:            public BatchUpdateException(String reason, String SQLState,
116:                    int vendorCode, int[] updateCounts) {
117:                super (reason, SQLState, vendorCode);
118:                this .updateCounts = updateCounts;
119:            }
120:
121:            /**
122:             * Gets the Update Counts array.
123:             * <p>
124:             * If a batch update command fails and a BatchUpdateException is thrown, the
125:             * JDBC driver may continue processing the remaining commands in the batch.
126:             * If the driver does process more commands after the problem occurs, the
127:             * array returned by <code>BatchUpdateException.getUpdateCounts</code> has
128:             * an element for every command in the batch, not only those that executed
129:             * successfully. In this case, the array element for any command which
130:             * encountered a problem is set to Statement.EXECUTE_FAILED.
131:             * 
132:             * @return an array that contains the successful update counts, before this
133:             *         exception. Alternatively, if the driver continues to process
134:             *         commands following an error, one of these listed items for every
135:             *         command the batch contains:
136:             *         <ol>
137:             *         <li>an count of the updates</li>
138:             *         <li><code>Statement.SUCCESS_NO_INFO</code> indicating that the
139:             *         command completed successfully, but the amount of altered rows is
140:             *         not known.</li>
141:             *         <li><code>Statement.EXECUTE_FAILED</code> indicating that the
142:             *         command was unsuccessful.
143:             *         </ol>
144:             */
145:            public int[] getUpdateCounts() {
146:                return updateCounts;
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.