Debian Codegraph @

src/main/org/h2/api/ErrorCode.java

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