1 | /* |
2 | * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, |
3 | * and the EPL 1.0 (http://h2database.com/html/license.html). |
4 | * Initial Developer: H2 Group |
5 | */ |
6 | package org.h2.api; |
7 | |
8 | /** |
9 | * This class defines the error codes used for SQL exceptions. |
10 | * Error messages are formatted as follows: |
11 | * <pre> |
12 | * { error message (possibly translated; may include quoted data) } |
13 | * { error message in English if different } |
14 | * { SQL statement if applicable } |
15 | * { [ error code - build number ] } |
16 | * </pre> |
17 | * Example: |
18 | * <pre> |
19 | * Syntax error in SQL statement "SELECT * FORM[*] TEST "; |
20 | * SQL statement: select * form test [42000-125] |
21 | * </pre> |
22 | * The [*] marks the position of the syntax error |
23 | * (FORM instead of FROM in this case). |
24 | * The error code is 42000, and the build number is 125, |
25 | * meaning version 1.2.125. |
26 | */ |
27 | public class ErrorCode { |
28 | |
29 | // 02: no data |
30 | |
31 | /** |
32 | * The error with code <code>2000</code> is thrown when |
33 | * the result set is positioned before the first or after the last row, or |
34 | * not on a valid row for the given operation. |
35 | * Example of wrong usage: |
36 | * <pre> |
37 | * ResultSet rs = stat.executeQuery("SELECT * FROM DUAL"); |
38 | * rs.getString(1); |
39 | * </pre> |
40 | * Correct: |
41 | * <pre> |
42 | * ResultSet rs = stat.executeQuery("SELECT * FROM DUAL"); |
43 | * rs.next(); |
44 | * rs.getString(1); |
45 | * </pre> |
46 | */ |
47 | public static final int NO_DATA_AVAILABLE = 2000; |
48 | |
49 | // 07: dynamic SQL error |
50 | |
51 | /** |
52 | * The error with code <code>7001</code> is thrown when |
53 | * trying to call a function with the wrong number of parameters. |
54 | * Example: |
55 | * <pre> |
56 | * CALL ABS(1, 2) |
57 | * </pre> |
58 | */ |
59 | public static final int INVALID_PARAMETER_COUNT_2 = 7001; |
60 | |
61 | // 08: connection exception |
62 | |
63 | /** |
64 | * The error with code <code>8000</code> is thrown when |
65 | * there was a problem trying to create a database lock. |
66 | * See the message and cause for details. |
67 | */ |
68 | public static final int ERROR_OPENING_DATABASE_1 = 8000; |
69 | |
70 | // 21: cardinality violation |
71 | |
72 | /** |
73 | * The error with code <code>21002</code> is thrown when the number of |
74 | * columns does not match. Possible reasons are: for an INSERT or MERGE |
75 | * statement, the column count does not match the table or the column list |
76 | * specified. For a SELECT UNION statement, both queries return a different |
77 | * number of columns. For a constraint, the number of referenced and |
78 | * referencing columns does not match. Example: |
79 | * <pre> |
80 | * CREATE TABLE TEST(ID INT, NAME VARCHAR); |
81 | * INSERT INTO TEST VALUES('Hello'); |
82 | * </pre> |
83 | */ |
84 | public static final int COLUMN_COUNT_DOES_NOT_MATCH = 21002; |
85 | |
86 | // 22: data exception |
87 | |
88 | /** |
89 | * The error with code <code>22001</code> is thrown when |
90 | * trying to insert a value that is too long for the column. |
91 | * Example: |
92 | * <pre> |
93 | * CREATE TABLE TEST(ID INT, NAME VARCHAR(2)); |
94 | * INSERT INTO TEST VALUES(1, 'Hello'); |
95 | * </pre> |
96 | */ |
97 | public static final int VALUE_TOO_LONG_2 = 22001; |
98 | |
99 | /** |
100 | * The error with code <code>22003</code> is thrown when a value is out of |
101 | * range when converting to another data type. Example: |
102 | * <pre> |
103 | * CALL CAST(1000000 AS TINYINT); |
104 | * SELECT CAST(124.34 AS DECIMAL(2, 2)); |
105 | * </pre> |
106 | */ |
107 | public static final int NUMERIC_VALUE_OUT_OF_RANGE_1 = 22003; |
108 | |
109 | /** |
110 | * The error with code <code>22007</code> is thrown when |
111 | * a text can not be converted to a date, time, or timestamp constant. |
112 | * Examples: |
113 | * <pre> |
114 | * CALL DATE '2007-January-01'; |
115 | * CALL TIME '14:61:00'; |
116 | * CALL TIMESTAMP '2001-02-30 12:00:00'; |
117 | * </pre> |
118 | */ |
119 | public static final int INVALID_DATETIME_CONSTANT_2 = 22007; |
120 | |
121 | /** |
122 | * The error with code <code>22012</code> is thrown when trying to divide |
123 | * a value by zero. Example: |
124 | * <pre> |
125 | * CALL 1/0; |
126 | * </pre> |
127 | */ |
128 | public static final int DIVISION_BY_ZERO_1 = 22012; |
129 | |
130 | /** |
131 | * The error with code <code>22018</code> is thrown when |
132 | * trying to convert a value to a data type where the conversion is |
133 | * undefined, or when an error occurred trying to convert. Example: |
134 | * <pre> |
135 | * CALL CAST(DATE '2001-01-01' AS BOOLEAN); |
136 | * CALL CAST('CHF 99.95' AS INT); |
137 | * </pre> |
138 | */ |
139 | public static final int DATA_CONVERSION_ERROR_1 = 22018; |
140 | |
141 | /** |
142 | * The error with code <code>22025</code> is thrown when using an invalid |
143 | * escape character sequence for LIKE or REGEXP. The default escape |
144 | * character is '\'. The escape character is required when searching for |
145 | * the characters '%', '_' and the escape character itself. That means if |
146 | * you want to search for the text '10%', you need to use LIKE '10\%'. If |
147 | * you want to search for 'C:\temp' you need to use 'C:\\temp'. The escape |
148 | * character can be changed using the ESCAPE clause as in LIKE '10+%' ESCAPE |
149 | * '+'. Example of wrong usage: |
150 | * <pre> |
151 | * CALL 'C:\temp' LIKE 'C:\temp'; |
152 | * CALL '1+1' LIKE '1+1' ESCAPE '+'; |
153 | * </pre> |
154 | * Correct: |
155 | * <pre> |
156 | * CALL 'C:\temp' LIKE 'C:\\temp'; |
157 | * CALL '1+1' LIKE '1++1' ESCAPE '+'; |
158 | * </pre> |
159 | */ |
160 | public static final int LIKE_ESCAPE_ERROR_1 = 22025; |
161 | |
162 | // 23: constraint violation |
163 | |
164 | /** |
165 | * The error with code <code>23502</code> is thrown when |
166 | * trying to insert NULL into a column that does not allow NULL. |
167 | * Example: |
168 | * <pre> |
169 | * CREATE TABLE TEST(ID INT, NAME VARCHAR NOT NULL); |
170 | * INSERT INTO TEST(ID) VALUES(1); |
171 | * </pre> |
172 | */ |
173 | public static final int NULL_NOT_ALLOWED = 23502; |
174 | |
175 | /** |
176 | * The error with code <code>23503</code> is thrown when trying to delete |
177 | * or update a row when this would violate a referential constraint, because |
178 | * there is a child row that would become an orphan. Example: |
179 | * <pre> |
180 | * CREATE TABLE TEST(ID INT PRIMARY KEY, PARENT INT); |
181 | * INSERT INTO TEST VALUES(1, 1), (2, 1); |
182 | * ALTER TABLE TEST ADD CONSTRAINT TEST_ID_PARENT |
183 | * FOREIGN KEY(PARENT) REFERENCES TEST(ID) ON DELETE RESTRICT; |
184 | * DELETE FROM TEST WHERE ID = 1; |
185 | * </pre> |
186 | */ |
187 | public static final int REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1 = 23503; |
188 | |
189 | /** |
190 | * The error with code <code>23505</code> is thrown when trying to insert |
191 | * a row that would violate a unique index or primary key. Example: |
192 | * <pre> |
193 | * CREATE TABLE TEST(ID INT PRIMARY KEY); |
194 | * INSERT INTO TEST VALUES(1); |
195 | * INSERT INTO TEST VALUES(1); |
196 | * </pre> |
197 | */ |
198 | public static final int DUPLICATE_KEY_1 = 23505; |
199 | |
200 | /** |
201 | * The error with code <code>23506</code> is thrown when trying to insert |
202 | * or update a row that would violate a referential constraint, because the |
203 | * referenced row does not exist. Example: |
204 | * <pre> |
205 | * CREATE TABLE PARENT(ID INT PRIMARY KEY); |
206 | * CREATE TABLE CHILD(P_ID INT REFERENCES PARENT(ID)); |
207 | * INSERT INTO CHILD VALUES(1); |
208 | * </pre> |
209 | */ |
210 | public static final int REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1 = 23506; |
211 | |
212 | /** |
213 | * The error with code <code>23507</code> is thrown when |
214 | * updating or deleting from a table with a foreign key constraint |
215 | * that should set the default value, but there is no default value defined. |
216 | * Example: |
217 | * <pre> |
218 | * CREATE TABLE TEST(ID INT PRIMARY KEY, PARENT INT); |
219 | * INSERT INTO TEST VALUES(1, 1), (2, 1); |
220 | * ALTER TABLE TEST ADD CONSTRAINT TEST_ID_PARENT |
221 | * FOREIGN KEY(PARENT) REFERENCES TEST(ID) ON DELETE SET DEFAULT; |
222 | * DELETE FROM TEST WHERE ID = 1; |
223 | * </pre> |
224 | */ |
225 | public static final int NO_DEFAULT_SET_1 = 23507; |
226 | |
227 | /** |
228 | * The error with code <code>23513</code> is thrown when |
229 | * a check constraint is violated. Example: |
230 | * <pre> |
231 | * CREATE TABLE TEST(ID INT CHECK ID>0); |
232 | * INSERT INTO TEST VALUES(0); |
233 | * </pre> |
234 | */ |
235 | public static final int CHECK_CONSTRAINT_VIOLATED_1 = 23513; |
236 | |
237 | /** |
238 | * The error with code <code>23514</code> is thrown when |
239 | * evaluation of a check constraint resulted in a error. |
240 | */ |
241 | public static final int CHECK_CONSTRAINT_INVALID = 23514; |
242 | |
243 | // 28: invalid authorization specification |
244 | |
245 | /** |
246 | * The error with code <code>28000</code> is thrown when |
247 | * there is no such user registered in the database, when the user password |
248 | * does not match, or when the database encryption password does not match |
249 | * (if database encryption is used). |
250 | */ |
251 | public static final int WRONG_USER_OR_PASSWORD = 28000; |
252 | |
253 | // 3B: savepoint exception |
254 | |
255 | /** |
256 | * The error with code <code>40001</code> is thrown when |
257 | * the database engine has detected a deadlock. The transaction of this |
258 | * session has been rolled back to solve the problem. A deadlock occurs when |
259 | * a session tries to lock a table another session has locked, while the |
260 | * other session wants to lock a table the first session has locked. As an |
261 | * example, session 1 has locked table A, while session 2 has locked table |
262 | * B. If session 1 now tries to lock table B and session 2 tries to lock |
263 | * table A, a deadlock has occurred. Deadlocks that involve more than two |
264 | * sessions are also possible. To solve deadlock problems, an application |
265 | * should lock tables always in the same order, such as always lock table A |
266 | * before locking table B. For details, see <a |
267 | * href="http://en.wikipedia.org/wiki/Deadlock">Wikipedia Deadlock</a>. |
268 | */ |
269 | public static final int DEADLOCK_1 = 40001; |
270 | |
271 | // 42: syntax error or access rule violation |
272 | |
273 | /** |
274 | * The error with code <code>42000</code> is thrown when |
275 | * trying to execute an invalid SQL statement. |
276 | * Example: |
277 | * <pre> |
278 | * CREATE ALIAS REMAINDER FOR "IEEEremainder"; |
279 | * </pre> |
280 | */ |
281 | public static final int SYNTAX_ERROR_1 = 42000; |
282 | |
283 | /** |
284 | * The error with code <code>42001</code> is thrown when |
285 | * trying to execute an invalid SQL statement. |
286 | * Example: |
287 | * <pre> |
288 | * CREATE TABLE TEST(ID INT); |
289 | * INSERT INTO TEST(1); |
290 | * </pre> |
291 | */ |
292 | public static final int SYNTAX_ERROR_2 = 42001; |
293 | |
294 | /** |
295 | * The error with code <code>42101</code> is thrown when |
296 | * trying to create a table or view if an object with this name already |
297 | * exists. Example: |
298 | * <pre> |
299 | * CREATE TABLE TEST(ID INT); |
300 | * CREATE TABLE TEST(ID INT PRIMARY KEY); |
301 | * </pre> |
302 | */ |
303 | public static final int TABLE_OR_VIEW_ALREADY_EXISTS_1 = 42101; |
304 | |
305 | /** |
306 | * The error with code <code>42102</code> is thrown when |
307 | * trying to query, modify or drop a table or view that does not exists |
308 | * in this schema and database. A common cause is that the wrong |
309 | * database was opened. |
310 | * Example: |
311 | * <pre> |
312 | * SELECT * FROM ABC; |
313 | * </pre> |
314 | */ |
315 | public static final int TABLE_OR_VIEW_NOT_FOUND_1 = 42102; |
316 | |
317 | /** |
318 | * The error with code <code>42111</code> is thrown when |
319 | * trying to create an index if an index with the same name already exists. |
320 | * Example: |
321 | * <pre> |
322 | * CREATE TABLE TEST(ID INT, NAME VARCHAR); |
323 | * CREATE INDEX IDX_ID ON TEST(ID); |
324 | * CREATE TABLE ADDRESS(ID INT); |
325 | * CREATE INDEX IDX_ID ON ADDRESS(ID); |
326 | * </pre> |
327 | */ |
328 | public static final int INDEX_ALREADY_EXISTS_1 = 42111; |
329 | |
330 | /** |
331 | * The error with code <code>42112</code> is thrown when |
332 | * trying to drop or reference an index that does not exist. |
333 | * Example: |
334 | * <pre> |
335 | * DROP INDEX ABC; |
336 | * </pre> |
337 | */ |
338 | public static final int INDEX_NOT_FOUND_1 = 42112; |
339 | |
340 | /** |
341 | * The error with code <code>42121</code> is thrown when trying to create |
342 | * a table or insert into a table and use the same column name twice. |
343 | * Example: |
344 | * <pre> |
345 | * CREATE TABLE TEST(ID INT, ID INT); |
346 | * </pre> |
347 | */ |
348 | public static final int DUPLICATE_COLUMN_NAME_1 = 42121; |
349 | |
350 | /** |
351 | * The error with code <code>42122</code> is thrown when |
352 | * referencing an non-existing column. |
353 | * Example: |
354 | * <pre> |
355 | * CREATE TABLE TEST(ID INT); |
356 | * SELECT NAME FROM TEST; |
357 | * </pre> |
358 | */ |
359 | public static final int COLUMN_NOT_FOUND_1 = 42122; |
360 | |
361 | // 0A: feature not supported |
362 | |
363 | // HZ: remote database access |
364 | |
365 | // |
366 | |
367 | /** |
368 | * The error with code <code>50000</code> is thrown when |
369 | * something unexpected occurs, for example an internal stack |
370 | * overflow. For details about the problem, see the cause of the |
371 | * exception in the stack trace. |
372 | */ |
373 | public static final int GENERAL_ERROR_1 = 50000; |
374 | |
375 | /** |
376 | * The error with code <code>50004</code> is thrown when |
377 | * creating a table with an unsupported data type, or |
378 | * when the data type is unknown because parameters are used. |
379 | * Example: |
380 | * <pre> |
381 | * CREATE TABLE TEST(ID VERYSMALLINT); |
382 | * </pre> |
383 | */ |
384 | public static final int UNKNOWN_DATA_TYPE_1 = 50004; |
385 | |
386 | /** |
387 | * The error with code <code>50100</code> is thrown when calling an |
388 | * unsupported JDBC method or database feature. See the stack trace for |
389 | * details. |
390 | */ |
391 | public static final int FEATURE_NOT_SUPPORTED_1 = 50100; |
392 | |
393 | /** |
394 | * The error with code <code>50200</code> is thrown when |
395 | * another connection locked an object longer than the lock timeout |
396 | * set for this connection, or when a deadlock occurred. |
397 | * Example: |
398 | * <pre> |
399 | * CREATE TABLE TEST(ID INT); |
400 | * -- connection 1: |
401 | * SET AUTOCOMMIT FALSE; |
402 | * INSERT INTO TEST VALUES(1); |
403 | * -- connection 2: |
404 | * SET AUTOCOMMIT FALSE; |
405 | * INSERT INTO TEST VALUES(1); |
406 | * </pre> |
407 | */ |
408 | public static final int LOCK_TIMEOUT_1 = 50200; |
409 | |
410 | /** |
411 | * The error with code <code>90000</code> is thrown when |
412 | * a function that does not return a result set was used in the FROM clause. |
413 | * Example: |
414 | * <pre> |
415 | * SELECT * FROM SIN(1); |
416 | * </pre> |
417 | */ |
418 | public static final int FUNCTION_MUST_RETURN_RESULT_SET_1 = 90000; |
419 | |
420 | /** |
421 | * The error with code <code>90001</code> is thrown when |
422 | * Statement.executeUpdate() was called for a SELECT statement. |
423 | * This is not allowed according to the JDBC specs. |
424 | */ |
425 | public static final int METHOD_NOT_ALLOWED_FOR_QUERY = 90001; |
426 | |
427 | /** |
428 | * The error with code <code>90002</code> is thrown when |
429 | * Statement.executeQuery() was called for a statement that does |
430 | * not return a result set (for example, an UPDATE statement). |
431 | * This is not allowed according to the JDBC specs. |
432 | */ |
433 | public static final int METHOD_ONLY_ALLOWED_FOR_QUERY = 90002; |
434 | |
435 | /** |
436 | * The error with code <code>90003</code> is thrown when |
437 | * trying to convert a String to a binary value. Two hex digits |
438 | * per byte are required. Example of wrong usage: |
439 | * <pre> |
440 | * CALL X'00023'; |
441 | * Hexadecimal string with odd number of characters: 00023 |
442 | * </pre> |
443 | * Correct: |
444 | * <pre> |
445 | * CALL X'000023'; |
446 | * </pre> |
447 | */ |
448 | public static final int HEX_STRING_ODD_1 = 90003; |
449 | |
450 | /** |
451 | * The error with code <code>90004</code> is thrown when |
452 | * trying to convert a text to binary, but the expression contains |
453 | * a non-hexadecimal character. |
454 | * Example: |
455 | * <pre> |
456 | * CALL X'ABCDEFGH'; |
457 | * CALL CAST('ABCDEFGH' AS BINARY); |
458 | * </pre> |
459 | * Conversion from text to binary is supported, but the text must |
460 | * represent the hexadecimal encoded bytes. |
461 | */ |
462 | public static final int HEX_STRING_WRONG_1 = 90004; |
463 | |
464 | /** |
465 | * The error with code <code>90005</code> is thrown when |
466 | * trying to create a trigger and using the combination of SELECT |
467 | * and FOR EACH ROW, which we do not support. |
468 | */ |
469 | public static final int TRIGGER_SELECT_AND_ROW_BASED_NOT_SUPPORTED = 90005; |
470 | |
471 | /** |
472 | * The error with code <code>90006</code> is thrown when |
473 | * trying to get a value from a sequence that has run out of numbers |
474 | * and does not have cycling enabled. |
475 | */ |
476 | public static final int SEQUENCE_EXHAUSTED = 90006; |
477 | |
478 | /** |
479 | * The error with code <code>90007</code> is thrown when |
480 | * trying to call a JDBC method on an object that has been closed. |
481 | */ |
482 | public static final int OBJECT_CLOSED = 90007; |
483 | |
484 | /** |
485 | * The error with code <code>90008</code> is thrown when |
486 | * trying to use a value that is not valid for the given operation. |
487 | * Example: |
488 | * <pre> |
489 | * CREATE SEQUENCE TEST INCREMENT 0; |
490 | * </pre> |
491 | */ |
492 | public static final int INVALID_VALUE_2 = 90008; |
493 | |
494 | /** |
495 | * The error with code <code>90009</code> is thrown when |
496 | * trying to create a sequence with an invalid combination |
497 | * of attributes (min value, max value, start value, etc). |
498 | */ |
499 | public static final int SEQUENCE_ATTRIBUTES_INVALID = 90009; |
500 | |
501 | /** |
502 | * The error with code <code>90010</code> is thrown when |
503 | * trying to format a timestamp or number using TO_CHAR |
504 | * with an invalid format. |
505 | */ |
506 | public static final int INVALID_TO_CHAR_FORMAT = 90010; |
507 | |
508 | /** |
509 | * The error with code <code>90011</code> is thrown when |
510 | * trying to open a connection to a database using an implicit relative |
511 | * path, such as "jdbc:h2:test" (in which case the database file would be |
512 | * stored in the current working directory of the application). This is not |
513 | * allowed because it can lead to confusion where the database file is, and |
514 | * can result in multiple databases because different working directories |
515 | * are used. Instead, use "jdbc:h2:~/name" (relative to the current user |
516 | * home directory), use an absolute path, set the base directory (baseDir), |
517 | * use "jdbc:h2:./name" (explicit relative path), or set the system property |
518 | * "h2.implicitRelativePath" to "true" (to prevent this check). For Windows, |
519 | * an absolute path also needs to include the drive ("C:/..."). Please see |
520 | * the documentation on the supported URL format. Example: |
521 | * <pre> |
522 | * jdbc:h2:test |
523 | * </pre> |
524 | */ |
525 | public static final int URL_RELATIVE_TO_CWD = 90011; |
526 | |
527 | /** |
528 | * The error with code <code>90012</code> is thrown when |
529 | * trying to execute a statement with an parameter. |
530 | * Example: |
531 | * <pre> |
532 | * CALL SIN(?); |
533 | * </pre> |
534 | */ |
535 | public static final int PARAMETER_NOT_SET_1 = 90012; |
536 | |
537 | /** |
538 | * The error with code <code>90013</code> is thrown when |
539 | * trying to open a database that does not exist using the flag |
540 | * IFEXISTS=TRUE, or when trying to access a database object with a catalog |
541 | * name that does not match the database name. Example: |
542 | * <pre> |
543 | * CREATE TABLE TEST(ID INT); |
544 | * SELECT XYZ.PUBLIC.TEST.ID FROM TEST; |
545 | * </pre> |
546 | */ |
547 | public static final int DATABASE_NOT_FOUND_1 = 90013; |
548 | |
549 | /** |
550 | * The error with code <code>90014</code> is thrown when |
551 | * trying to parse a date with an unsupported format string, or |
552 | * when the date can not be parsed. |
553 | * Example: |
554 | * <pre> |
555 | * CALL PARSEDATETIME('2001 January', 'yyyy mm'); |
556 | * </pre> |
557 | */ |
558 | public static final int PARSE_ERROR_1 = 90014; |
559 | |
560 | /** |
561 | * The error with code <code>90015</code> is thrown when |
562 | * using an aggregate function with a data type that is not supported. |
563 | * Example: |
564 | * <pre> |
565 | * SELECT SUM('Hello') FROM DUAL; |
566 | * </pre> |
567 | */ |
568 | public static final int SUM_OR_AVG_ON_WRONG_DATATYPE_1 = 90015; |
569 | |
570 | /** |
571 | * The error with code <code>90016</code> is thrown when |
572 | * a column was used in the expression list or the order by clause of a |
573 | * group or aggregate query, and that column is not in the GROUP BY clause. |
574 | * Example of wrong usage: |
575 | * <pre> |
576 | * CREATE TABLE TEST(ID INT, NAME VARCHAR); |
577 | * INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World'); |
578 | * SELECT ID, MAX(NAME) FROM TEST; |
579 | * Column ID must be in the GROUP BY list. |
580 | * </pre> |
581 | * Correct: |
582 | * <pre> |
583 | * SELECT ID, MAX(NAME) FROM TEST GROUP BY ID; |
584 | * </pre> |
585 | */ |
586 | public static final int MUST_GROUP_BY_COLUMN_1 = 90016; |
587 | |
588 | /** |
589 | * The error with code <code>90017</code> is thrown when |
590 | * trying to define a second primary key constraint for this table. |
591 | * Example: |
592 | * <pre> |
593 | * CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR); |
594 | * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(NAME); |
595 | * </pre> |
596 | */ |
597 | public static final int SECOND_PRIMARY_KEY = 90017; |
598 | |
599 | /** |
600 | * The error with code <code>90018</code> is thrown when |
601 | * the connection was opened, but never closed. In the finalizer of the |
602 | * connection, this forgotten close was detected and the connection was |
603 | * closed automatically, but relying on the finalizer is not good practice |
604 | * as it is not guaranteed and behavior is virtual machine dependent. The |
605 | * application should close the connection. This exception only appears in |
606 | * the .trace.db file. Example of wrong usage: |
607 | * <pre> |
608 | * Connection conn; |
609 | * conn = DriverManager.getConnection("jdbc:h2:˜/test"); |
610 | * conn = null; |
611 | * The connection was not closed by the application and is |
612 | * garbage collected |
613 | * </pre> |
614 | * Correct: |
615 | * <pre> |
616 | * conn.close(); |
617 | * </pre> |
618 | */ |
619 | public static final int TRACE_CONNECTION_NOT_CLOSED = 90018; |
620 | |
621 | /** |
622 | * The error with code <code>90019</code> is thrown when |
623 | * trying to drop the current user, if there are no other admin users. |
624 | * Example: |
625 | * <pre> |
626 | * DROP USER SA; |
627 | * </pre> |
628 | */ |
629 | public static final int CANNOT_DROP_CURRENT_USER = 90019; |
630 | |
631 | /** |
632 | * The error with code <code>90020</code> is thrown when trying to open a |
633 | * database in embedded mode if this database is already in use in another |
634 | * process (or in a different class loader). Multiple connections to the |
635 | * same database are supported in the following cases: |
636 | * <ul><li>In embedded mode (URL of the form jdbc:h2:~/test) if all |
637 | * connections are opened within the same process and class loader. |
638 | * </li><li>In server and cluster mode (URL of the form |
639 | * jdbc:h2:tcp://localhost/test) using remote connections. |
640 | * </li></ul> |
641 | * The mixed mode is also supported. This mode requires to start a server |
642 | * in the same process where the database is open in embedded mode. |
643 | */ |
644 | public static final int DATABASE_ALREADY_OPEN_1 = 90020; |
645 | |
646 | /** |
647 | * The error with code <code>90021</code> is thrown when |
648 | * trying to change a specific database property that conflicts with other |
649 | * database properties. |
650 | */ |
651 | public static final int UNSUPPORTED_SETTING_COMBINATION = 90021; |
652 | |
653 | /** |
654 | * The error with code <code>90022</code> is thrown when |
655 | * trying to call a unknown function. |
656 | * Example: |
657 | * <pre> |
658 | * CALL SPECIAL_SIN(10); |
659 | * </pre> |
660 | */ |
661 | public static final int FUNCTION_NOT_FOUND_1 = 90022; |
662 | |
663 | /** |
664 | * The error with code <code>90023</code> is thrown when |
665 | * trying to set a primary key on a nullable column. |
666 | * Example: |
667 | * <pre> |
668 | * CREATE TABLE TEST(ID INT, NAME VARCHAR); |
669 | * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(ID); |
670 | * </pre> |
671 | */ |
672 | public static final int COLUMN_MUST_NOT_BE_NULLABLE_1 = 90023; |
673 | |
674 | /** |
675 | * The error with code <code>90024</code> is thrown when |
676 | * a file could not be renamed. |
677 | */ |
678 | public static final int FILE_RENAME_FAILED_2 = 90024; |
679 | |
680 | /** |
681 | * The error with code <code>90025</code> is thrown when |
682 | * a file could not be deleted, because it is still in use |
683 | * (only in Windows), or because an error occurred when deleting. |
684 | */ |
685 | public static final int FILE_DELETE_FAILED_1 = 90025; |
686 | |
687 | /** |
688 | * The error with code <code>90026</code> is thrown when |
689 | * an object could not be serialized. |
690 | */ |
691 | public static final int SERIALIZATION_FAILED_1 = 90026; |
692 | |
693 | /** |
694 | * The error with code <code>90027</code> is thrown when |
695 | * an object could not be de-serialized. |
696 | */ |
697 | public static final int DESERIALIZATION_FAILED_1 = 90027; |
698 | |
699 | /** |
700 | * The error with code <code>90028</code> is thrown when |
701 | * an input / output error occurred. For more information, see the root |
702 | * cause of the exception. |
703 | */ |
704 | public static final int IO_EXCEPTION_1 = 90028; |
705 | |
706 | /** |
707 | * The error with code <code>90029</code> is thrown when |
708 | * calling ResultSet.deleteRow(), insertRow(), or updateRow() |
709 | * when the current row is not updatable. |
710 | * Example: |
711 | * <pre> |
712 | * ResultSet rs = stat.executeQuery("SELECT * FROM TEST"); |
713 | * rs.next(); |
714 | * rs.insertRow(); |
715 | * </pre> |
716 | */ |
717 | public static final int NOT_ON_UPDATABLE_ROW = 90029; |
718 | |
719 | /** |
720 | * The error with code <code>90030</code> is thrown when |
721 | * the database engine has detected a checksum mismatch in the data |
722 | * or index. To solve this problem, restore a backup or use the |
723 | * Recovery tool (org.h2.tools.Recover). |
724 | */ |
725 | public static final int FILE_CORRUPTED_1 = 90030; |
726 | |
727 | /** |
728 | * The error with code <code>90031</code> is thrown when |
729 | * an input / output error occurred. For more information, see the root |
730 | * cause of the exception. |
731 | */ |
732 | public static final int IO_EXCEPTION_2 = 90031; |
733 | |
734 | /** |
735 | * The error with code <code>90032</code> is thrown when |
736 | * trying to drop or alter a user that does not exist. |
737 | * Example: |
738 | * <pre> |
739 | * DROP USER TEST_USER; |
740 | * </pre> |
741 | */ |
742 | public static final int USER_NOT_FOUND_1 = 90032; |
743 | |
744 | /** |
745 | * The error with code <code>90033</code> is thrown when |
746 | * trying to create a user or role if a user with this name already exists. |
747 | * Example: |
748 | * <pre> |
749 | * CREATE USER TEST_USER; |
750 | * CREATE USER TEST_USER; |
751 | * </pre> |
752 | */ |
753 | public static final int USER_ALREADY_EXISTS_1 = 90033; |
754 | |
755 | /** |
756 | * The error with code <code>90034</code> is thrown when |
757 | * writing to the trace file failed, for example because the there |
758 | * is an I/O exception. This message is printed to System.out, |
759 | * but only once. |
760 | */ |
761 | public static final int TRACE_FILE_ERROR_2 = 90034; |
762 | |
763 | /** |
764 | * The error with code <code>90035</code> is thrown when |
765 | * trying to create a sequence if a sequence with this name already |
766 | * exists. |
767 | * Example: |
768 | * <pre> |
769 | * CREATE SEQUENCE TEST_SEQ; |
770 | * CREATE SEQUENCE TEST_SEQ; |
771 | * </pre> |
772 | */ |
773 | public static final int SEQUENCE_ALREADY_EXISTS_1 = 90035; |
774 | |
775 | /** |
776 | * The error with code <code>90036</code> is thrown when |
777 | * trying to access a sequence that does not exist. |
778 | * Example: |
779 | * <pre> |
780 | * SELECT NEXT VALUE FOR SEQUENCE XYZ; |
781 | * </pre> |
782 | */ |
783 | public static final int SEQUENCE_NOT_FOUND_1 = 90036; |
784 | |
785 | /** |
786 | * The error with code <code>90037</code> is thrown when |
787 | * trying to drop or alter a view that does not exist. |
788 | * Example: |
789 | * <pre> |
790 | * DROP VIEW XYZ; |
791 | * </pre> |
792 | */ |
793 | public static final int VIEW_NOT_FOUND_1 = 90037; |
794 | |
795 | /** |
796 | * The error with code <code>90038</code> is thrown when |
797 | * trying to create a view if a view with this name already |
798 | * exists. |
799 | * Example: |
800 | * <pre> |
801 | * CREATE VIEW DUMMY AS SELECT * FROM DUAL; |
802 | * CREATE VIEW DUMMY AS SELECT * FROM DUAL; |
803 | * </pre> |
804 | */ |
805 | public static final int VIEW_ALREADY_EXISTS_1 = 90038; |
806 | |
807 | /** |
808 | * The error with code <code>90040</code> is thrown when |
809 | * a user that is not administrator tries to execute a statement |
810 | * that requires admin privileges. |
811 | */ |
812 | public static final int ADMIN_RIGHTS_REQUIRED = 90040; |
813 | |
814 | /** |
815 | * The error with code <code>90041</code> is thrown when |
816 | * trying to create a trigger and there is already a trigger with that name. |
817 | * <pre> |
818 | * CREATE TABLE TEST(ID INT); |
819 | * CREATE TRIGGER TRIGGER_A AFTER INSERT ON TEST |
820 | * CALL "org.h2.samples.TriggerSample$MyTrigger"; |
821 | * CREATE TRIGGER TRIGGER_A AFTER INSERT ON TEST |
822 | * CALL "org.h2.samples.TriggerSample$MyTrigger"; |
823 | * </pre> |
824 | */ |
825 | public static final int TRIGGER_ALREADY_EXISTS_1 = 90041; |
826 | |
827 | /** |
828 | * The error with code <code>90042</code> is thrown when |
829 | * trying to drop a trigger that does not exist. |
830 | * Example: |
831 | * <pre> |
832 | * DROP TRIGGER TRIGGER_XYZ; |
833 | * </pre> |
834 | */ |
835 | public static final int TRIGGER_NOT_FOUND_1 = 90042; |
836 | |
837 | /** |
838 | * The error with code <code>90043</code> is thrown when |
839 | * there is an error initializing the trigger, for example because the |
840 | * class does not implement the Trigger interface. |
841 | * See the root cause for details. |
842 | * Example: |
843 | * <pre> |
844 | * CREATE TABLE TEST(ID INT); |
845 | * CREATE TRIGGER TRIGGER_A AFTER INSERT ON TEST |
846 | * CALL "java.lang.String"; |
847 | * </pre> |
848 | */ |
849 | public static final int ERROR_CREATING_TRIGGER_OBJECT_3 = 90043; |
850 | |
851 | /** |
852 | * The error with code <code>90044</code> is thrown when |
853 | * an exception or error occurred while calling the triggers fire method. |
854 | * See the root cause for details. |
855 | */ |
856 | public static final int ERROR_EXECUTING_TRIGGER_3 = 90044; |
857 | |
858 | /** |
859 | * The error with code <code>90045</code> is thrown when trying to create a |
860 | * constraint if an object with this name already exists. Example: |
861 | * <pre> |
862 | * CREATE TABLE TEST(ID INT NOT NULL); |
863 | * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(ID); |
864 | * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(ID); |
865 | * </pre> |
866 | */ |
867 | public static final int CONSTRAINT_ALREADY_EXISTS_1 = 90045; |
868 | |
869 | /** |
870 | * The error with code <code>90046</code> is thrown when |
871 | * trying to open a connection to a database using an unsupported URL |
872 | * format. Please see the documentation on the supported URL format and |
873 | * examples. Example: |
874 | * <pre> |
875 | * jdbc:h2:;; |
876 | * </pre> |
877 | */ |
878 | public static final int URL_FORMAT_ERROR_2 = 90046; |
879 | |
880 | /** |
881 | * The error with code <code>90047</code> is thrown when |
882 | * trying to connect to a TCP server with an incompatible client. |
883 | */ |
884 | public static final int DRIVER_VERSION_ERROR_2 = 90047; |
885 | |
886 | /** |
887 | * The error with code <code>90048</code> is thrown when |
888 | * the file header of a database files (*.db) does not match the |
889 | * expected version, or if it is corrupted. |
890 | */ |
891 | public static final int FILE_VERSION_ERROR_1 = 90048; |
892 | |
893 | /** |
894 | * The error with code <code>90049</code> is thrown when |
895 | * trying to open an encrypted database with the wrong file encryption |
896 | * password or algorithm. |
897 | */ |
898 | public static final int FILE_ENCRYPTION_ERROR_1 = 90049; |
899 | |
900 | /** |
901 | * The error with code <code>90050</code> is thrown when trying to open an |
902 | * encrypted database, but not separating the file password from the user |
903 | * password. The file password is specified in the password field, before |
904 | * the user password. A single space needs to be added between the file |
905 | * password and the user password; the file password itself may not contain |
906 | * spaces. File passwords (as well as user passwords) are case sensitive. |
907 | * Example of wrong usage: |
908 | * <pre> |
909 | * String url = "jdbc:h2:˜/test;CIPHER=AES"; |
910 | * String passwords = "filePasswordUserPassword"; |
911 | * DriverManager.getConnection(url, "sa", pwds); |
912 | * </pre> |
913 | * Correct: |
914 | * <pre> |
915 | * String url = "jdbc:h2:˜/test;CIPHER=AES"; |
916 | * String passwords = "filePassword userPassword"; |
917 | * DriverManager.getConnection(url, "sa", pwds); |
918 | * </pre> |
919 | */ |
920 | public static final int WRONG_PASSWORD_FORMAT = 90050; |
921 | |
922 | /** |
923 | * The error with code <code>57014</code> is thrown when |
924 | * a statement was canceled using Statement.cancel() or |
925 | * when the query timeout has been reached. |
926 | * Examples: |
927 | * <pre> |
928 | * stat.setQueryTimeout(1); |
929 | * stat.cancel(); |
930 | * </pre> |
931 | */ |
932 | public static final int STATEMENT_WAS_CANCELED = 57014; |
933 | |
934 | /** |
935 | * The error with code <code>90052</code> is thrown when |
936 | * a subquery that is used as a value contains more than one column. |
937 | * Example of wrong usage: |
938 | * <pre> |
939 | * CREATE TABLE TEST(ID INT); |
940 | * INSERT INTO TEST VALUES(1), (2); |
941 | * SELECT * FROM TEST WHERE ID IN (SELECT 1, 2 FROM DUAL); |
942 | * </pre> |
943 | * Correct: |
944 | * <pre> |
945 | * CREATE TABLE TEST(ID INT); |
946 | * INSERT INTO TEST VALUES(1), (2); |
947 | * SELECT * FROM TEST WHERE ID IN (1, 2); |
948 | * </pre> |
949 | */ |
950 | public static final int SUBQUERY_IS_NOT_SINGLE_COLUMN = 90052; |
951 | |
952 | /** |
953 | * The error with code <code>90053</code> is thrown when |
954 | * a subquery that is used as a value contains more than one row. |
955 | * Example: |
956 | * <pre> |
957 | * CREATE TABLE TEST(ID INT, NAME VARCHAR); |
958 | * INSERT INTO TEST VALUES(1, 'Hello'), (1, 'World'); |
959 | * SELECT X, (SELECT NAME FROM TEST WHERE ID=X) FROM DUAL; |
960 | * </pre> |
961 | */ |
962 | public static final int SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW = 90053; |
963 | |
964 | /** |
965 | * The error with code <code>90054</code> is thrown when |
966 | * an aggregate function is used where it is not allowed. |
967 | * Example: |
968 | * <pre> |
969 | * CREATE TABLE TEST(ID INT); |
970 | * INSERT INTO TEST VALUES(1), (2); |
971 | * SELECT MAX(ID) FROM TEST WHERE ID = MAX(ID) GROUP BY ID; |
972 | * </pre> |
973 | */ |
974 | public static final int INVALID_USE_OF_AGGREGATE_FUNCTION_1 = 90054; |
975 | |
976 | /** |
977 | * The error with code <code>90055</code> is thrown when |
978 | * trying to open a database with an unsupported cipher algorithm. |
979 | * Supported is AES. |
980 | * Example: |
981 | * <pre> |
982 | * jdbc:h2:~/test;CIPHER=DES |
983 | * </pre> |
984 | */ |
985 | public static final int UNSUPPORTED_CIPHER = 90055; |
986 | |
987 | /** |
988 | * The error with code <code>90057</code> is thrown when |
989 | * trying to drop a constraint that does not exist. |
990 | * Example: |
991 | * <pre> |
992 | * CREATE TABLE TEST(ID INT); |
993 | * ALTER TABLE TEST DROP CONSTRAINT CID; |
994 | * </pre> |
995 | */ |
996 | public static final int CONSTRAINT_NOT_FOUND_1 = 90057; |
997 | |
998 | /** |
999 | * The error with code <code>90058</code> is thrown when trying to call |
1000 | * commit or rollback inside a trigger, or when trying to call a method |
1001 | * inside a trigger that implicitly commits the current transaction, if an |
1002 | * object is locked. This is not because it would release the lock too |
1003 | * early. |
1004 | */ |
1005 | public static final int COMMIT_ROLLBACK_NOT_ALLOWED = 90058; |
1006 | |
1007 | /** |
1008 | * The error with code <code>90059</code> is thrown when |
1009 | * a query contains a column that could belong to multiple tables. |
1010 | * Example: |
1011 | * <pre> |
1012 | * CREATE TABLE PARENT(ID INT, NAME VARCHAR); |
1013 | * CREATE TABLE CHILD(PID INT, NAME VARCHAR); |
1014 | * SELECT ID, NAME FROM PARENT P, CHILD C WHERE P.ID = C.PID; |
1015 | * </pre> |
1016 | */ |
1017 | public static final int AMBIGUOUS_COLUMN_NAME_1 = 90059; |
1018 | |
1019 | /** |
1020 | * The error with code <code>90060</code> is thrown when |
1021 | * trying to use a file locking mechanism that is not supported. |
1022 | * Currently only FILE (the default) and SOCKET are supported |
1023 | * Example: |
1024 | * <pre> |
1025 | * jdbc:h2:~/test;FILE_LOCK=LDAP |
1026 | * </pre> |
1027 | */ |
1028 | public static final int UNSUPPORTED_LOCK_METHOD_1 = 90060; |
1029 | |
1030 | /** |
1031 | * The error with code <code>90061</code> is thrown when |
1032 | * trying to start a server if a server is already running at the same port. |
1033 | * It could also be a firewall problem. To find out if another server is |
1034 | * already running, run the following command on Windows: |
1035 | * <pre> |
1036 | * netstat -ano |
1037 | * </pre> |
1038 | * The column PID is the process id as listed in the Task Manager. |
1039 | * For Linux, use: |
1040 | * <pre> |
1041 | * netstat -npl |
1042 | * </pre> |
1043 | */ |
1044 | public static final int EXCEPTION_OPENING_PORT_2 = 90061; |
1045 | |
1046 | /** |
1047 | * The error with code <code>90062</code> is thrown when |
1048 | * a directory or file could not be created. This can occur when |
1049 | * trying to create a directory if a file with the same name already |
1050 | * exists, or vice versa. |
1051 | * |
1052 | */ |
1053 | public static final int FILE_CREATION_FAILED_1 = 90062; |
1054 | |
1055 | /** |
1056 | * The error with code <code>90063</code> is thrown when |
1057 | * trying to rollback to a savepoint that is not defined. |
1058 | * Example: |
1059 | * <pre> |
1060 | * ROLLBACK TO SAVEPOINT S_UNKNOWN; |
1061 | * </pre> |
1062 | */ |
1063 | public static final int SAVEPOINT_IS_INVALID_1 = 90063; |
1064 | |
1065 | /** |
1066 | * The error with code <code>90064</code> is thrown when |
1067 | * Savepoint.getSavepointName() is called on an unnamed savepoint. |
1068 | * Example: |
1069 | * <pre> |
1070 | * Savepoint sp = conn.setSavepoint(); |
1071 | * sp.getSavepointName(); |
1072 | * </pre> |
1073 | */ |
1074 | public static final int SAVEPOINT_IS_UNNAMED = 90064; |
1075 | |
1076 | /** |
1077 | * The error with code <code>90065</code> is thrown when |
1078 | * Savepoint.getSavepointId() is called on a named savepoint. |
1079 | * Example: |
1080 | * <pre> |
1081 | * Savepoint sp = conn.setSavepoint("Joe"); |
1082 | * sp.getSavepointId(); |
1083 | * </pre> |
1084 | */ |
1085 | public static final int SAVEPOINT_IS_NAMED = 90065; |
1086 | |
1087 | /** |
1088 | * The error with code <code>90066</code> is thrown when |
1089 | * the same property appears twice in the database URL or in |
1090 | * the connection properties. |
1091 | * Example: |
1092 | * <pre> |
1093 | * jdbc:h2:~/test;LOCK_TIMEOUT=0;LOCK_TIMEOUT=1 |
1094 | * </pre> |
1095 | */ |
1096 | public static final int DUPLICATE_PROPERTY_1 = 90066; |
1097 | |
1098 | /** |
1099 | * The error with code <code>90067</code> is thrown when the client could |
1100 | * not connect to the database, or if the connection was lost. Possible |
1101 | * reasons are: the database server is not running at the given port, the |
1102 | * connection was closed due to a shutdown, or the server was stopped. Other |
1103 | * possible causes are: the server is not an H2 server, or the network |
1104 | * connection is broken. |
1105 | */ |
1106 | public static final int CONNECTION_BROKEN_1 = 90067; |
1107 | |
1108 | /** |
1109 | * The error with code <code>90068</code> is thrown when the given |
1110 | * expression that is used in the ORDER BY is not in the result list. This |
1111 | * is required for distinct queries, otherwise the result would be |
1112 | * ambiguous. |
1113 | * Example of wrong usage: |
1114 | * <pre> |
1115 | * CREATE TABLE TEST(ID INT, NAME VARCHAR); |
1116 | * INSERT INTO TEST VALUES(2, 'Hello'), (1, 'Hello'); |
1117 | * SELECT DISTINCT NAME FROM TEST ORDER BY ID; |
1118 | * Order by expression ID must be in the result list in this case |
1119 | * </pre> |
1120 | * Correct: |
1121 | * <pre> |
1122 | * SELECT DISTINCT ID, NAME FROM TEST ORDER BY ID; |
1123 | * </pre> |
1124 | */ |
1125 | public static final int ORDER_BY_NOT_IN_RESULT = 90068; |
1126 | |
1127 | /** |
1128 | * The error with code <code>90069</code> is thrown when |
1129 | * trying to create a role if an object with this name already exists. |
1130 | * Example: |
1131 | * <pre> |
1132 | * CREATE ROLE TEST_ROLE; |
1133 | * CREATE ROLE TEST_ROLE; |
1134 | * </pre> |
1135 | */ |
1136 | public static final int ROLE_ALREADY_EXISTS_1 = 90069; |
1137 | |
1138 | /** |
1139 | * The error with code <code>90070</code> is thrown when |
1140 | * trying to drop or grant a role that does not exists. |
1141 | * Example: |
1142 | * <pre> |
1143 | * DROP ROLE TEST_ROLE_2; |
1144 | * </pre> |
1145 | */ |
1146 | public static final int ROLE_NOT_FOUND_1 = 90070; |
1147 | |
1148 | /** |
1149 | * The error with code <code>90071</code> is thrown when |
1150 | * trying to grant or revoke if no role or user with that name exists. |
1151 | * Example: |
1152 | * <pre> |
1153 | * GRANT SELECT ON TEST TO UNKNOWN; |
1154 | * </pre> |
1155 | */ |
1156 | public static final int USER_OR_ROLE_NOT_FOUND_1 = 90071; |
1157 | |
1158 | /** |
1159 | * The error with code <code>90072</code> is thrown when |
1160 | * trying to grant or revoke both roles and rights at the same time. |
1161 | * Example: |
1162 | * <pre> |
1163 | * GRANT SELECT, TEST_ROLE ON TEST TO SA; |
1164 | * </pre> |
1165 | */ |
1166 | public static final int ROLES_AND_RIGHT_CANNOT_BE_MIXED = 90072; |
1167 | |
1168 | /** |
1169 | * The error with code <code>90073</code> is thrown when trying to create |
1170 | * an alias for a Java method, if two methods exists in this class that have |
1171 | * this name and the same number of parameters. |
1172 | * Example of wrong usage: |
1173 | * <pre> |
1174 | * CREATE ALIAS GET_LONG FOR |
1175 | * "java.lang.Long.getLong"; |
1176 | * </pre> |
1177 | * Correct: |
1178 | * <pre> |
1179 | * CREATE ALIAS GET_LONG FOR |
1180 | * "java.lang.Long.getLong(java.lang.String, java.lang.Long)"; |
1181 | * </pre> |
1182 | */ |
1183 | public static final int METHODS_MUST_HAVE_DIFFERENT_PARAMETER_COUNTS_2 = 90073; |
1184 | |
1185 | /** |
1186 | * The error with code <code>90074</code> is thrown when |
1187 | * trying to grant a role that has already been granted. |
1188 | * Example: |
1189 | * <pre> |
1190 | * CREATE ROLE TEST_A; |
1191 | * CREATE ROLE TEST_B; |
1192 | * GRANT TEST_A TO TEST_B; |
1193 | * GRANT TEST_B TO TEST_A; |
1194 | * </pre> |
1195 | */ |
1196 | public static final int ROLE_ALREADY_GRANTED_1 = 90074; |
1197 | |
1198 | /** |
1199 | * The error with code <code>90075</code> is thrown when |
1200 | * trying to alter a table and allow null for a column that is part of a |
1201 | * primary key or hash index. |
1202 | * Example: |
1203 | * <pre> |
1204 | * CREATE TABLE TEST(ID INT PRIMARY KEY); |
1205 | * ALTER TABLE TEST ALTER COLUMN ID NULL; |
1206 | * </pre> |
1207 | */ |
1208 | public static final int COLUMN_IS_PART_OF_INDEX_1 = 90075; |
1209 | |
1210 | /** |
1211 | * The error with code <code>90076</code> is thrown when |
1212 | * trying to create a function alias for a system function or for a function |
1213 | * that is already defined. |
1214 | * Example: |
1215 | * <pre> |
1216 | * CREATE ALIAS SQRT FOR "java.lang.Math.sqrt" |
1217 | * </pre> |
1218 | */ |
1219 | public static final int FUNCTION_ALIAS_ALREADY_EXISTS_1 = 90076; |
1220 | |
1221 | /** |
1222 | * The error with code <code>90077</code> is thrown when |
1223 | * trying to drop a system function or a function alias that does not exist. |
1224 | * Example: |
1225 | * <pre> |
1226 | * DROP ALIAS SQRT; |
1227 | * </pre> |
1228 | */ |
1229 | public static final int FUNCTION_ALIAS_NOT_FOUND_1 = 90077; |
1230 | |
1231 | /** |
1232 | * The error with code <code>90078</code> is thrown when |
1233 | * trying to create a schema if an object with this name already exists. |
1234 | * Example: |
1235 | * <pre> |
1236 | * CREATE SCHEMA TEST_SCHEMA; |
1237 | * CREATE SCHEMA TEST_SCHEMA; |
1238 | * </pre> |
1239 | */ |
1240 | public static final int SCHEMA_ALREADY_EXISTS_1 = 90078; |
1241 | |
1242 | /** |
1243 | * The error with code <code>90079</code> is thrown when |
1244 | * trying to drop a schema that does not exist. |
1245 | * Example: |
1246 | * <pre> |
1247 | * DROP SCHEMA UNKNOWN; |
1248 | * </pre> |
1249 | */ |
1250 | public static final int SCHEMA_NOT_FOUND_1 = 90079; |
1251 | |
1252 | /** |
1253 | * The error with code <code>90080</code> is thrown when |
1254 | * trying to rename a object to a different schema, or when trying to |
1255 | * create a related object in another schema. |
1256 | * For CREATE LINKED TABLE, it is thrown when multiple tables with that |
1257 | * name exist in different schemas. |
1258 | * Example: |
1259 | * <pre> |
1260 | * CREATE SCHEMA TEST_SCHEMA; |
1261 | * CREATE TABLE TEST(ID INT); |
1262 | * CREATE INDEX TEST_ID ON TEST(ID); |
1263 | * ALTER INDEX TEST_ID RENAME TO TEST_SCHEMA.IDX_TEST_ID; |
1264 | * </pre> |
1265 | */ |
1266 | public static final int SCHEMA_NAME_MUST_MATCH = 90080; |
1267 | |
1268 | /** |
1269 | * The error with code <code>90081</code> is thrown when |
1270 | * trying to alter a column to not allow NULL, if there |
1271 | * is already data in the table where this column is NULL. |
1272 | * Example: |
1273 | * <pre> |
1274 | * CREATE TABLE TEST(ID INT); |
1275 | * INSERT INTO TEST VALUES(NULL); |
1276 | * ALTER TABLE TEST ALTER COLUMN ID VARCHAR NOT NULL; |
1277 | * </pre> |
1278 | */ |
1279 | public static final int COLUMN_CONTAINS_NULL_VALUES_1 = 90081; |
1280 | |
1281 | /** |
1282 | * The error with code <code>90082</code> is thrown when |
1283 | * trying to drop a system generated sequence. |
1284 | */ |
1285 | public static final int SEQUENCE_BELONGS_TO_A_TABLE_1 = 90082; |
1286 | |
1287 | /** |
1288 | * The error with code <code>90083</code> is thrown when |
1289 | * trying to drop a column that is part of a constraint. |
1290 | * Example: |
1291 | * <pre> |
1292 | * CREATE TABLE TEST(ID INT, PID INT REFERENCES(ID)); |
1293 | * ALTER TABLE TEST DROP COLUMN PID; |
1294 | * </pre> |
1295 | */ |
1296 | public static final int COLUMN_IS_REFERENCED_1 = 90083; |
1297 | |
1298 | /** |
1299 | * The error with code <code>90084</code> is thrown when |
1300 | * trying to drop the last column of a table. |
1301 | * Example: |
1302 | * <pre> |
1303 | * CREATE TABLE TEST(ID INT); |
1304 | * ALTER TABLE TEST DROP COLUMN ID; |
1305 | * </pre> |
1306 | */ |
1307 | public static final int CANNOT_DROP_LAST_COLUMN = 90084; |
1308 | |
1309 | /** |
1310 | * The error with code <code>90085</code> is thrown when |
1311 | * trying to manually drop an index that was generated by the system |
1312 | * because of a unique or referential constraint. To find out what |
1313 | * constraint causes the problem, run: |
1314 | * <pre> |
1315 | * SELECT * FROM INFORMATION_SCHEMA.CONSTRAINTS |
1316 | * WHERE UNIQUE_INDEX_NAME = '<index name>'; |
1317 | * </pre> |
1318 | * Example of wrong usage: |
1319 | * <pre> |
1320 | * CREATE TABLE TEST(ID INT, CONSTRAINT UID UNIQUE(ID)); |
1321 | * DROP INDEX UID_INDEX_0; |
1322 | * Index UID_INDEX_0 belongs to constraint UID |
1323 | * </pre> |
1324 | * Correct: |
1325 | * <pre> |
1326 | * ALTER TABLE TEST DROP CONSTRAINT UID; |
1327 | * </pre> |
1328 | */ |
1329 | public static final int INDEX_BELONGS_TO_CONSTRAINT_2 = 90085; |
1330 | |
1331 | /** |
1332 | * The error with code <code>90086</code> is thrown when |
1333 | * a class can not be loaded because it is not in the classpath |
1334 | * or because a related class is not in the classpath. |
1335 | * Example: |
1336 | * <pre> |
1337 | * CREATE ALIAS TEST FOR "java.lang.invalid.Math.sqrt"; |
1338 | * </pre> |
1339 | */ |
1340 | public static final int CLASS_NOT_FOUND_1 = 90086; |
1341 | |
1342 | /** |
1343 | * The error with code <code>90087</code> is thrown when |
1344 | * the specified method was not found in the class. |
1345 | * Example: |
1346 | * <pre> |
1347 | * CREATE ALIAS TO_BINARY FOR "java.lang.Long.toBinaryString(long)"; |
1348 | * CALL TO_BINARY(10, 2); |
1349 | * </pre> |
1350 | */ |
1351 | public static final int METHOD_NOT_FOUND_1 = 90087; |
1352 | |
1353 | /** |
1354 | * The error with code <code>90088</code> is thrown when |
1355 | * trying to switch to an unknown mode. |
1356 | * Example: |
1357 | * <pre> |
1358 | * SET MODE UNKNOWN; |
1359 | * </pre> |
1360 | */ |
1361 | public static final int UNKNOWN_MODE_1 = 90088; |
1362 | |
1363 | /** |
1364 | * The error with code <code>90089</code> is thrown when |
1365 | * trying to change the collation while there was already data in |
1366 | * the database. The collation of the database must be set when the |
1367 | * database is empty. |
1368 | * Example of wrong usage: |
1369 | * <pre> |
1370 | * CREATE TABLE TEST(NAME VARCHAR PRIMARY KEY); |
1371 | * INSERT INTO TEST VALUES('Hello', 'World'); |
1372 | * SET COLLATION DE; |
1373 | * Collation cannot be changed because there is a data table: PUBLIC.TEST |
1374 | * </pre> |
1375 | * Correct: |
1376 | * <pre> |
1377 | * SET COLLATION DE; |
1378 | * CREATE TABLE TEST(NAME VARCHAR PRIMARY KEY); |
1379 | * INSERT INTO TEST VALUES('Hello', 'World'); |
1380 | * </pre> |
1381 | */ |
1382 | public static final int COLLATION_CHANGE_WITH_DATA_TABLE_1 = 90089; |
1383 | |
1384 | /** |
1385 | * The error with code <code>90090</code> is thrown when |
1386 | * trying to drop a schema that may not be dropped (the schema PUBLIC |
1387 | * and the schema INFORMATION_SCHEMA). |
1388 | * Example: |
1389 | * <pre> |
1390 | * DROP SCHEMA PUBLIC; |
1391 | * </pre> |
1392 | */ |
1393 | public static final int SCHEMA_CAN_NOT_BE_DROPPED_1 = 90090; |
1394 | |
1395 | /** |
1396 | * The error with code <code>90091</code> is thrown when |
1397 | * trying to drop the role PUBLIC. |
1398 | * Example: |
1399 | * <pre> |
1400 | * DROP ROLE PUBLIC; |
1401 | * </pre> |
1402 | */ |
1403 | public static final int ROLE_CAN_NOT_BE_DROPPED_1 = 90091; |
1404 | |
1405 | /** |
1406 | * The error with code <code>90093</code> is thrown when |
1407 | * trying to connect to a clustered database that runs in standalone |
1408 | * mode. This can happen if clustering is not enabled on the database, |
1409 | * or if one of the clients disabled clustering because it can not see |
1410 | * the other cluster node. |
1411 | */ |
1412 | public static final int CLUSTER_ERROR_DATABASE_RUNS_ALONE = 90093; |
1413 | |
1414 | /** |
1415 | * The error with code <code>90094</code> is thrown when |
1416 | * trying to connect to a clustered database that runs together with a |
1417 | * different cluster node setting than what is used when trying to connect. |
1418 | */ |
1419 | public static final int CLUSTER_ERROR_DATABASE_RUNS_CLUSTERED_1 = 90094; |
1420 | |
1421 | /** |
1422 | * The error with code <code>90095</code> is thrown when |
1423 | * calling the method STRINGDECODE with an invalid escape sequence. |
1424 | * Only Java style escape sequences and Java properties file escape |
1425 | * sequences are supported. |
1426 | * Example: |
1427 | * <pre> |
1428 | * CALL STRINGDECODE('\i'); |
1429 | * </pre> |
1430 | */ |
1431 | public static final int STRING_FORMAT_ERROR_1 = 90095; |
1432 | |
1433 | /** |
1434 | * The error with code <code>90096</code> is thrown when |
1435 | * trying to perform an operation with a non-admin user if the |
1436 | * user does not have enough rights. |
1437 | */ |
1438 | public static final int NOT_ENOUGH_RIGHTS_FOR_1 = 90096; |
1439 | |
1440 | /** |
1441 | * The error with code <code>90097</code> is thrown when |
1442 | * trying to delete or update a database if it is open in read-only mode. |
1443 | * Example: |
1444 | * <pre> |
1445 | * jdbc:h2:~/test;ACCESS_MODE_DATA=R |
1446 | * CREATE TABLE TEST(ID INT); |
1447 | * </pre> |
1448 | */ |
1449 | public static final int DATABASE_IS_READ_ONLY = 90097; |
1450 | |
1451 | /** |
1452 | * The error with code <code>90098</code> is thrown when the database has |
1453 | * been closed, for example because the system ran out of memory or because |
1454 | * the self-destruction counter has reached zero. This counter is only used |
1455 | * for recovery testing, and not set in normal operation. |
1456 | */ |
1457 | public static final int DATABASE_IS_CLOSED = 90098; |
1458 | |
1459 | /** |
1460 | * The error with code <code>90099</code> is thrown when an error occurred |
1461 | * trying to initialize the database event listener. Example: |
1462 | * <pre> |
1463 | * jdbc:h2:˜/test;DATABASE_EVENT_LISTENER='java.lang.String' |
1464 | * </pre> |
1465 | */ |
1466 | public static final int ERROR_SETTING_DATABASE_EVENT_LISTENER_2 = 90099; |
1467 | |
1468 | /** |
1469 | * The error with code <code>90101</code> is thrown when |
1470 | * the XA API detected unsupported transaction names. This can happen |
1471 | * when mixing application generated transaction names and transaction names |
1472 | * generated by this databases XAConnection API. |
1473 | */ |
1474 | public static final int WRONG_XID_FORMAT_1 = 90101; |
1475 | |
1476 | /** |
1477 | * The error with code <code>90102</code> is thrown when |
1478 | * trying to use unsupported options for the given compression algorithm. |
1479 | * Example of wrong usage: |
1480 | * <pre> |
1481 | * CALL COMPRESS(STRINGTOUTF8(SPACE(100)), 'DEFLATE l 10'); |
1482 | * </pre> |
1483 | * Correct: |
1484 | * <pre> |
1485 | * CALL COMPRESS(STRINGTOUTF8(SPACE(100)), 'DEFLATE l 9'); |
1486 | * </pre> |
1487 | */ |
1488 | public static final int UNSUPPORTED_COMPRESSION_OPTIONS_1 = 90102; |
1489 | |
1490 | /** |
1491 | * The error with code <code>90103</code> is thrown when |
1492 | * trying to use an unsupported compression algorithm. |
1493 | * Example: |
1494 | * <pre> |
1495 | * CALL COMPRESS(STRINGTOUTF8(SPACE(100)), 'BZIP'); |
1496 | * </pre> |
1497 | */ |
1498 | public static final int UNSUPPORTED_COMPRESSION_ALGORITHM_1 = 90103; |
1499 | |
1500 | /** |
1501 | * The error with code <code>90104</code> is thrown when |
1502 | * the data can not be de-compressed. |
1503 | * Example: |
1504 | * <pre> |
1505 | * CALL EXPAND(X'00FF'); |
1506 | * </pre> |
1507 | */ |
1508 | public static final int COMPRESSION_ERROR = 90104; |
1509 | |
1510 | /** |
1511 | * The error with code <code>90105</code> is thrown when |
1512 | * an exception occurred in a user-defined method. |
1513 | * Example: |
1514 | * <pre> |
1515 | * CREATE ALIAS SYS_PROP FOR "java.lang.System.getProperty"; |
1516 | * CALL SYS_PROP(NULL); |
1517 | * </pre> |
1518 | */ |
1519 | public static final int EXCEPTION_IN_FUNCTION_1 = 90105; |
1520 | |
1521 | /** |
1522 | * The error with code <code>90106</code> is thrown when |
1523 | * trying to truncate a table that can not be truncated. |
1524 | * Tables with referential integrity constraints can not be truncated. |
1525 | * Also, system tables and view can not be truncated. |
1526 | * Example: |
1527 | * <pre> |
1528 | * TRUNCATE TABLE INFORMATION_SCHEMA.SETTINGS; |
1529 | * </pre> |
1530 | */ |
1531 | public static final int CANNOT_TRUNCATE_1 = 90106; |
1532 | |
1533 | /** |
1534 | * The error with code <code>90107</code> is thrown when |
1535 | * trying to drop an object because another object would become invalid. |
1536 | * Example: |
1537 | * <pre> |
1538 | * CREATE TABLE COUNT(X INT); |
1539 | * CREATE TABLE ITEMS(ID INT DEFAULT SELECT MAX(X)+1 FROM COUNT); |
1540 | * DROP TABLE COUNT; |
1541 | * </pre> |
1542 | */ |
1543 | public static final int CANNOT_DROP_2 = 90107; |
1544 | |
1545 | /** |
1546 | * The error with code <code>90108</code> is thrown when not enough heap |
1547 | * memory was available. A possible solutions is to increase the memory size |
1548 | * using <code>java -Xmx128m ...</code>. Another solution is to reduce |
1549 | * the cache size. |
1550 | */ |
1551 | public static final int OUT_OF_MEMORY = 90108; |
1552 | |
1553 | /** |
1554 | * The error with code <code>90109</code> is thrown when |
1555 | * trying to run a query against an invalid view. |
1556 | * Example: |
1557 | * <pre> |
1558 | * CREATE FORCE VIEW TEST_VIEW AS SELECT * FROM TEST; |
1559 | * SELECT * FROM TEST_VIEW; |
1560 | * </pre> |
1561 | */ |
1562 | public static final int VIEW_IS_INVALID_2 = 90109; |
1563 | |
1564 | /** |
1565 | * The error with code <code>90111</code> is thrown when |
1566 | * an exception occurred while accessing a linked table. |
1567 | */ |
1568 | public static final int ERROR_ACCESSING_LINKED_TABLE_2 = 90111; |
1569 | |
1570 | /** |
1571 | * The error with code <code>90112</code> is thrown when a row was deleted |
1572 | * twice while locking was disabled. This is an intern exception that should |
1573 | * never be thrown to the application, because such deleted should be |
1574 | * detected and the resulting exception ignored inside the database engine. |
1575 | * <pre> |
1576 | * Row not found when trying to delete from index UID_INDEX_0 |
1577 | * </pre> |
1578 | */ |
1579 | public static final int ROW_NOT_FOUND_WHEN_DELETING_1 = 90112; |
1580 | |
1581 | /** |
1582 | * The error with code <code>90113</code> is thrown when |
1583 | * the database URL contains unsupported settings. |
1584 | * Example: |
1585 | * <pre> |
1586 | * jdbc:h2:~/test;UNKNOWN=TRUE |
1587 | * </pre> |
1588 | */ |
1589 | public static final int UNSUPPORTED_SETTING_1 = 90113; |
1590 | |
1591 | /** |
1592 | * The error with code <code>90114</code> is thrown when |
1593 | * trying to create a constant if a constant with this name already exists. |
1594 | * Example: |
1595 | * <pre> |
1596 | * CREATE CONSTANT TEST VALUE 1; |
1597 | * CREATE CONSTANT TEST VALUE 1; |
1598 | * </pre> |
1599 | */ |
1600 | public static final int CONSTANT_ALREADY_EXISTS_1 = 90114; |
1601 | |
1602 | /** |
1603 | * The error with code <code>90115</code> is thrown when |
1604 | * trying to drop a constant that does not exists. |
1605 | * Example: |
1606 | * <pre> |
1607 | * DROP CONSTANT UNKNOWN; |
1608 | * </pre> |
1609 | */ |
1610 | public static final int CONSTANT_NOT_FOUND_1 = 90115; |
1611 | |
1612 | /** |
1613 | * The error with code <code>90116</code> is thrown when |
1614 | * trying use a literal in a SQL statement if literals are disabled. |
1615 | * If literals are disabled, use PreparedStatement and parameters instead |
1616 | * of literals in the SQL statement. |
1617 | * Example: |
1618 | * <pre> |
1619 | * SET ALLOW_LITERALS NONE; |
1620 | * CALL 1+1; |
1621 | * </pre> |
1622 | */ |
1623 | public static final int LITERALS_ARE_NOT_ALLOWED = 90116; |
1624 | |
1625 | /** |
1626 | * The error with code <code>90117</code> is thrown when |
1627 | * trying to connect to a TCP server from another machine, if remote |
1628 | * connections are not allowed. To allow remote connections, |
1629 | * start the TCP server using the option -tcpAllowOthers as in: |
1630 | * <pre> |
1631 | * java org.h2.tools.Server -tcp -tcpAllowOthers |
1632 | * </pre> |
1633 | * Or, when starting the server from an application, use: |
1634 | * <pre> |
1635 | * Server server = Server.createTcpServer("-tcpAllowOthers"); |
1636 | * server.start(); |
1637 | * </pre> |
1638 | */ |
1639 | public static final int REMOTE_CONNECTION_NOT_ALLOWED = 90117; |
1640 | |
1641 | /** |
1642 | * The error with code <code>90118</code> is thrown when |
1643 | * trying to drop a table can not be dropped. |
1644 | * Example: |
1645 | * <pre> |
1646 | * DROP TABLE INFORMATION_SCHEMA.SETTINGS; |
1647 | * </pre> |
1648 | */ |
1649 | public static final int CANNOT_DROP_TABLE_1 = 90118; |
1650 | |
1651 | /** |
1652 | * The error with code <code>90119</code> is thrown when |
1653 | * trying to create a domain if an object with this name already exists, |
1654 | * or when trying to overload a built-in data type. |
1655 | * Example: |
1656 | * <pre> |
1657 | * CREATE DOMAIN INTEGER AS VARCHAR; |
1658 | * CREATE DOMAIN EMAIL AS VARCHAR CHECK LOCATE('@', VALUE) > 0; |
1659 | * CREATE DOMAIN EMAIL AS VARCHAR CHECK LOCATE('@', VALUE) > 0; |
1660 | * </pre> |
1661 | */ |
1662 | public static final int USER_DATA_TYPE_ALREADY_EXISTS_1 = 90119; |
1663 | |
1664 | /** |
1665 | * The error with code <code>90120</code> is thrown when |
1666 | * trying to drop a domain that doesn't exist. |
1667 | * Example: |
1668 | * <pre> |
1669 | * DROP DOMAIN UNKNOWN; |
1670 | * </pre> |
1671 | */ |
1672 | public static final int USER_DATA_TYPE_NOT_FOUND_1 = 90120; |
1673 | |
1674 | /** |
1675 | * The error with code <code>90121</code> is thrown when |
1676 | * a database operation is started while the virtual machine exits |
1677 | * (for example in a shutdown hook), or when the session is closed. |
1678 | */ |
1679 | public static final int DATABASE_CALLED_AT_SHUTDOWN = 90121; |
1680 | |
1681 | /** |
1682 | * The error with code <code>90123</code> is thrown when |
1683 | * trying mix regular parameters and indexed parameters in the same |
1684 | * statement. Example: |
1685 | * <pre> |
1686 | * SELECT ?, ?1 FROM DUAL; |
1687 | * </pre> |
1688 | */ |
1689 | public static final int CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS = 90123; |
1690 | |
1691 | /** |
1692 | * The error with code <code>90124</code> is thrown when |
1693 | * trying to access a file that doesn't exist. This can occur when trying to |
1694 | * read a lob if the lob file has been deleted by another application. |
1695 | */ |
1696 | public static final int FILE_NOT_FOUND_1 = 90124; |
1697 | |
1698 | /** |
1699 | * The error with code <code>90125</code> is thrown when |
1700 | * PreparedStatement.setBigDecimal is called with object that extends the |
1701 | * class BigDecimal, and the system property h2.allowBigDecimalExtensions is |
1702 | * not set. Using extensions of BigDecimal is dangerous because the database |
1703 | * relies on the behavior of BigDecimal. Example of wrong usage: |
1704 | * <pre> |
1705 | * BigDecimal bd = new MyDecimal("$10.3"); |
1706 | * prep.setBigDecimal(1, bd); |
1707 | * Invalid class, expected java.math.BigDecimal but got MyDecimal |
1708 | * </pre> |
1709 | * Correct: |
1710 | * <pre> |
1711 | * BigDecimal bd = new BigDecimal("10.3"); |
1712 | * prep.setBigDecimal(1, bd); |
1713 | * </pre> |
1714 | */ |
1715 | public static final int INVALID_CLASS_2 = 90125; |
1716 | |
1717 | /** |
1718 | * The error with code <code>90126</code> is thrown when |
1719 | * trying to call the BACKUP statement for an in-memory database. |
1720 | * Example: |
1721 | * <pre> |
1722 | * jdbc:h2:mem: |
1723 | * BACKUP TO 'test.zip'; |
1724 | * </pre> |
1725 | */ |
1726 | public static final int DATABASE_IS_NOT_PERSISTENT = 90126; |
1727 | |
1728 | /** |
1729 | * The error with code <code>90127</code> is thrown when |
1730 | * trying to update or delete a row in a result set if the result set is |
1731 | * not updatable. Result sets are only updatable if: |
1732 | * the statement was created with updatable concurrency; |
1733 | * all columns of the result set are from the same table; |
1734 | * the table is a data table (not a system table or view); |
1735 | * all columns of the primary key or any unique index are included; |
1736 | * all columns of the result set are columns of that table. |
1737 | */ |
1738 | public static final int RESULT_SET_NOT_UPDATABLE = 90127; |
1739 | |
1740 | /** |
1741 | * The error with code <code>90128</code> is thrown when |
1742 | * trying to call a method of the ResultSet that is only supported |
1743 | * for scrollable result sets, and the result set is not scrollable. |
1744 | * Example: |
1745 | * <pre> |
1746 | * rs.first(); |
1747 | * </pre> |
1748 | */ |
1749 | public static final int RESULT_SET_NOT_SCROLLABLE = 90128; |
1750 | |
1751 | /** |
1752 | * The error with code <code>90129</code> is thrown when |
1753 | * trying to commit a transaction that doesn't exist. |
1754 | * Example: |
1755 | * <pre> |
1756 | * PREPARE COMMIT ABC; |
1757 | * COMMIT TRANSACTION TEST; |
1758 | * </pre> |
1759 | */ |
1760 | public static final int TRANSACTION_NOT_FOUND_1 = 90129; |
1761 | |
1762 | /** |
1763 | * The error with code <code>90130</code> is thrown when |
1764 | * an execute method of PreparedStatement was called with a SQL statement. |
1765 | * This is not allowed according to the JDBC specification. Instead, use |
1766 | * an execute method of Statement. |
1767 | * Example of wrong usage: |
1768 | * <pre> |
1769 | * PreparedStatement prep = conn.prepareStatement("SELECT * FROM TEST"); |
1770 | * prep.execute("DELETE FROM TEST"); |
1771 | * </pre> |
1772 | * Correct: |
1773 | * <pre> |
1774 | * Statement stat = conn.createStatement(); |
1775 | * stat.execute("DELETE FROM TEST"); |
1776 | * </pre> |
1777 | */ |
1778 | public static final int METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT = 90130; |
1779 | |
1780 | /** |
1781 | * The error with code <code>90131</code> is thrown when using multi version |
1782 | * concurrency control, and trying to update the same row from within two |
1783 | * connections at the same time, or trying to insert two rows with the same |
1784 | * key from two connections. Example: |
1785 | * <pre> |
1786 | * jdbc:h2:~/test;MVCC=TRUE |
1787 | * Session 1: |
1788 | * CREATE TABLE TEST(ID INT); |
1789 | * INSERT INTO TEST VALUES(1); |
1790 | * SET AUTOCOMMIT FALSE; |
1791 | * UPDATE TEST SET ID = 2; |
1792 | * Session 2: |
1793 | * SET AUTOCOMMIT FALSE; |
1794 | * UPDATE TEST SET ID = 3; |
1795 | * </pre> |
1796 | */ |
1797 | public static final int CONCURRENT_UPDATE_1 = 90131; |
1798 | |
1799 | /** |
1800 | * The error with code <code>90132</code> is thrown when |
1801 | * trying to drop a user-defined aggregate function that doesn't exist. |
1802 | * Example: |
1803 | * <pre> |
1804 | * DROP AGGREGATE UNKNOWN; |
1805 | * </pre> |
1806 | */ |
1807 | public static final int AGGREGATE_NOT_FOUND_1 = 90132; |
1808 | |
1809 | /** |
1810 | * The error with code <code>90133</code> is thrown when |
1811 | * trying to change a specific database property while the database is |
1812 | * already open. The MVCC property needs to be set in the first connection |
1813 | * (in the connection opening the database) and can not be changed later on. |
1814 | */ |
1815 | public static final int CANNOT_CHANGE_SETTING_WHEN_OPEN_1 = 90133; |
1816 | |
1817 | /** |
1818 | * The error with code <code>90134</code> is thrown when |
1819 | * trying to load a Java class that is not part of the allowed classes. By |
1820 | * default, all classes are allowed, but this can be changed using the |
1821 | * system property h2.allowedClasses. |
1822 | */ |
1823 | public static final int ACCESS_DENIED_TO_CLASS_1 = 90134; |
1824 | |
1825 | /** |
1826 | * The error with code <code>90135</code> is thrown when |
1827 | * trying to open a connection to a database that is currently open |
1828 | * in exclusive mode. The exclusive mode is set using: |
1829 | * <pre> |
1830 | * SET EXCLUSIVE TRUE; |
1831 | * </pre> |
1832 | */ |
1833 | public static final int DATABASE_IS_IN_EXCLUSIVE_MODE = 90135; |
1834 | |
1835 | /** |
1836 | * The error with code <code>90136</code> is thrown when |
1837 | * executing a query that used an unsupported outer join condition. |
1838 | * Example: |
1839 | * <pre> |
1840 | * SELECT * FROM DUAL A LEFT JOIN DUAL B ON B.X=(SELECT MAX(X) FROM DUAL); |
1841 | * </pre> |
1842 | */ |
1843 | public static final int UNSUPPORTED_OUTER_JOIN_CONDITION_1 = 90136; |
1844 | |
1845 | /** |
1846 | * The error with code <code>90137</code> is thrown when |
1847 | * trying to assign a value to something that is not a variable. |
1848 | * <pre> |
1849 | * SELECT AMOUNT, SET(@V, IFNULL(@V, 0)+AMOUNT) FROM TEST; |
1850 | * </pre> |
1851 | */ |
1852 | public static final int CAN_ONLY_ASSIGN_TO_VARIABLE_1 = 90137; |
1853 | |
1854 | /** |
1855 | * The error with code <code>90138</code> is thrown when |
1856 | * |
1857 | * trying to open a persistent database using an incorrect database name. |
1858 | * The name of a persistent database contains the path and file name prefix |
1859 | * where the data is stored. The file name part of a database name must be |
1860 | * at least two characters. |
1861 | * |
1862 | * Example of wrong usage: |
1863 | * <pre> |
1864 | * DriverManager.getConnection("jdbc:h2:~/t"); |
1865 | * DriverManager.getConnection("jdbc:h2:~/test/"); |
1866 | * </pre> |
1867 | * Correct: |
1868 | * <pre> |
1869 | * DriverManager.getConnection("jdbc:h2:~/te"); |
1870 | * DriverManager.getConnection("jdbc:h2:~/test/te"); |
1871 | * </pre> |
1872 | */ |
1873 | public static final int INVALID_DATABASE_NAME_1 = 90138; |
1874 | |
1875 | /** |
1876 | * The error with code <code>90139</code> is thrown when |
1877 | * the specified public static Java method was not found in the class. |
1878 | * Example: |
1879 | * <pre> |
1880 | * CREATE ALIAS TEST FOR "java.lang.Math.test"; |
1881 | * </pre> |
1882 | */ |
1883 | public static final int PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1 = 90139; |
1884 | |
1885 | /** |
1886 | * The error with code <code>90140</code> is thrown when trying to update or |
1887 | * delete a row in a result set if the statement was not created with |
1888 | * updatable concurrency. Result sets are only updatable if the statement |
1889 | * was created with updatable concurrency, and if the result set contains |
1890 | * all columns of the primary key or of a unique index of a table. |
1891 | */ |
1892 | public static final int RESULT_SET_READONLY = 90140; |
1893 | |
1894 | |
1895 | /** |
1896 | * The error with code <code>90141</code> is thrown when |
1897 | * trying to change the java object serializer while there was already data |
1898 | * in the database. The serializer of the database must be set when the |
1899 | * database is empty. |
1900 | */ |
1901 | public static final int JAVA_OBJECT_SERIALIZER_CHANGE_WITH_DATA_TABLE = 90141; |
1902 | |
1903 | /** |
1904 | * The error with code <code>90142</code> is thrown when |
1905 | * trying to set zero for step size. |
1906 | */ |
1907 | public static final int STEP_SIZE_MUST_NOT_BE_ZERO = 90142; |
1908 | |
1909 | |
1910 | // next are 90039, 90051, 90056, 90110, 90122, 90143 |
1911 | |
1912 | private ErrorCode() { |
1913 | // utility class |
1914 | } |
1915 | |
1916 | /** |
1917 | * INTERNAL |
1918 | */ |
1919 | public static boolean isCommon(int errorCode) { |
1920 | // this list is sorted alphabetically |
1921 | switch (errorCode) { |
1922 | case DATA_CONVERSION_ERROR_1: |
1923 | case DUPLICATE_KEY_1: |
1924 | case FUNCTION_ALIAS_ALREADY_EXISTS_1: |
1925 | case LOCK_TIMEOUT_1: |
1926 | case NULL_NOT_ALLOWED: |
1927 | case NO_DATA_AVAILABLE: |
1928 | case NUMERIC_VALUE_OUT_OF_RANGE_1: |
1929 | case OBJECT_CLOSED: |
1930 | case REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1: |
1931 | case REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1: |
1932 | case SYNTAX_ERROR_1: |
1933 | case SYNTAX_ERROR_2: |
1934 | case TABLE_OR_VIEW_ALREADY_EXISTS_1: |
1935 | case TABLE_OR_VIEW_NOT_FOUND_1: |
1936 | case VALUE_TOO_LONG_2: |
1937 | return true; |
1938 | } |
1939 | return false; |
1940 | } |
1941 | |
1942 | /** |
1943 | * INTERNAL |
1944 | */ |
1945 | public static String getState(int errorCode) { |
1946 | // To convert SQLState to error code, replace |
1947 | // 21S: 210, 42S: 421, HY: 50, C: 1, T: 2 |
1948 | |
1949 | switch (errorCode) { |
1950 | |
1951 | // 02: no data |
1952 | case NO_DATA_AVAILABLE: return "02000"; |
1953 | |
1954 | // 07: dynamic SQL error |
1955 | case INVALID_PARAMETER_COUNT_2: return "07001"; |
1956 | |
1957 | // 08: connection exception |
1958 | case ERROR_OPENING_DATABASE_1: return "08000"; |
1959 | |
1960 | // 21: cardinality violation |
1961 | case COLUMN_COUNT_DOES_NOT_MATCH: return "21S02"; |
1962 | |
1963 | // 42: syntax error or access rule violation |
1964 | case TABLE_OR_VIEW_ALREADY_EXISTS_1: return "42S01"; |
1965 | case TABLE_OR_VIEW_NOT_FOUND_1: return "42S02"; |
1966 | case INDEX_ALREADY_EXISTS_1: return "42S11"; |
1967 | case INDEX_NOT_FOUND_1: return "42S12"; |
1968 | case DUPLICATE_COLUMN_NAME_1: return "42S21"; |
1969 | case COLUMN_NOT_FOUND_1: return "42S22"; |
1970 | |
1971 | // 0A: feature not supported |
1972 | |
1973 | // HZ: remote database access |
1974 | |
1975 | // HY |
1976 | case GENERAL_ERROR_1: return "HY000"; |
1977 | case UNKNOWN_DATA_TYPE_1: return "HY004"; |
1978 | |
1979 | case FEATURE_NOT_SUPPORTED_1: return "HYC00"; |
1980 | case LOCK_TIMEOUT_1: return "HYT00"; |
1981 | default: |
1982 | return "" + errorCode; |
1983 | } |
1984 | } |
1985 | |
1986 | } |