File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\constant\ErrorCode.java.html

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