0001: /*
0002: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
0003: * (http://h2database.com/html/license.html).
0004: * Initial Developer: H2 Group
0005: */
0006: package org.h2.constant;
0007:
0008: /**
0009: * This class defines the error codes used for SQL exceptions.
0010: */
0011: public class ErrorCode {
0012:
0013: // 02: no data
0014: /**
0015: * The error with code <code>2000</code> is thrown when
0016: * the result set is positioned before the first or after the last row, or
0017: * not on a valid row for the given operation.
0018: * Example:
0019: * <pre>
0020: * ResultSet rs = stat.executeQuery("SELECT * FROM DUAL");
0021: * rs.getString(1);
0022: * </pre>
0023: * Correct:
0024: * <pre>
0025: * ResultSet rs = stat.executeQuery("SELECT * FROM DUAL");
0026: * rs.next();
0027: * rs.getString(1);
0028: * </pre>
0029: */
0030: public static final int NO_DATA_AVAILABLE = 2000;
0031:
0032: // 07: dynamic SQL error
0033: /**
0034: * The error with code <code>7001</code> is thrown when
0035: * trying to call a function with the wrong number of parameters.
0036: * Example:
0037: * <pre>
0038: * CALL ABS(1, 2)
0039: * </pre>
0040: */
0041: public static final int INVALID_PARAMETER_COUNT_2 = 7001;
0042:
0043: // 08: connection exception
0044: /**
0045: * The error with code <code>8000</code> is thrown when
0046: * there was a problem trying to create a database lock.
0047: * See the cause for details.
0048: */
0049: public static final int ERROR_OPENING_DATABASE = 8000;
0050:
0051: /**
0052: * The error with code <code>8004</code> is thrown when
0053: * there is no such user registered in the database, when
0054: * the user password does not match, or when the database encryption password
0055: * does not match (if database encryption is used).
0056: */
0057: public static final int WRONG_USER_OR_PASSWORD = 8004;
0058:
0059: // 21: cardinality violation
0060: /**
0061: * The error with code <code>21002</code> is thrown when the number of
0062: * columns does not match. Possible reasons are: for an INSERT or MERGE
0063: * statement, the column count does not match the table or the column list
0064: * specified. For a SELECT UNION statement, both queries return a different
0065: * number of columns. For a constraint, the number of referenced and
0066: * referencing columns does not match. Example:
0067: * <pre>
0068: * CREATE TABLE TEST(ID INT, NAME VARCHAR);
0069: * INSERT INTO TEST VALUES('Hello');
0070: * </pre>
0071: */
0072: public static final int COLUMN_COUNT_DOES_NOT_MATCH = 21002;
0073:
0074: // 22: data exception
0075: /**
0076: * The error with code <code>22003</code> is thrown when a value is out of
0077: * range when converting to another data type. Example:
0078: * <pre>
0079: * CALL CAST(1000000 AS TINYINT);
0080: * </pre>
0081: */
0082: public static final int NUMERIC_VALUE_OUT_OF_RANGE = 22003;
0083:
0084: /**
0085: * The error with code <code>22012</code> is thrown when trying to divide
0086: * a value by zero. Example:
0087: * <pre>
0088: * CALL 1/0;
0089: * </pre>
0090: */
0091: public static final int DIVISION_BY_ZERO_1 = 22012;
0092:
0093: /**
0094: * The error with code <code>22025</code> is thrown when using an invalid
0095: * escape character sequence for LIKE or REGEXP. Example:
0096: * <pre>
0097: * CALL 'Hello' LIKE '1+' ESCAPE '+';
0098: * </pre>
0099: */
0100: public static final int LIKE_ESCAPE_ERROR_1 = 22025;
0101:
0102: // 23: integrity constraint violation
0103: /**
0104: * The error with code <code>23000</code> is thrown when a check
0105: * constraint is violated. Example:
0106: * <pre>
0107: * CREATE TABLE TEST(ID INT CHECK ID>0);
0108: * INSERT INTO TEST VALUES(0);
0109: * </pre>
0110: */
0111: public static final int CHECK_CONSTRAINT_VIOLATED_1 = 23000;
0112:
0113: /**
0114: * The error with code <code>23001</code> is thrown when trying to insert
0115: * a row that would violate a unique index or primary key. Example:
0116: * <pre>
0117: * CREATE TABLE TEST(ID INT PRIMARY KEY);
0118: * INSERT INTO TEST VALUES(1);
0119: * INSERT INTO TEST VALUES(1);
0120: * </pre>
0121: */
0122: public static final int DUPLICATE_KEY_1 = 23001;
0123:
0124: /**
0125: * The error with code <code>23002</code> is thrown when trying to insert
0126: * or update a row that would violate a referential constraint, because the
0127: * referenced row does not exist. Example:
0128: * <pre>
0129: * CREATE TABLE PARENT(ID INT);
0130: * CREATE TABLE CHILD(P_ID INT REFERENCES PARENT(ID));
0131: * INSERT INTO CHILD VALUES(1);
0132: * </pre>
0133: */
0134: public static final int REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1 = 23002;
0135:
0136: /**
0137: * The error with code <code>23003</code> is thrown when trying to delete
0138: * or update a row when this would violate a referential constraint, because
0139: * there is a child row that would become an orphan. Example:
0140: * <pre>
0141: * CREATE TABLE PARENT(ID INT);
0142: * CREATE TABLE CHILD(P_ID INT REFERENCES PARENT(ID));
0143: * INSERT INTO PARENT VALUES(1);
0144: * INSERT INTO CHILD VALUES(1);
0145: * DELETE FROM PARENT;
0146: * </pre>
0147: */
0148: public static final int REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1 = 23003;
0149:
0150: // 3B: savepoint exception
0151:
0152: // 42: syntax error or access rule violation
0153: /**
0154: * The error with code <code>42000</code> is thrown when
0155: * trying to execute an invalid SQL statement.
0156: * Example:
0157: * <pre>
0158: * CREATE ALIAS REMAINDER FOR "IEEEremainder";
0159: * </pre>
0160: */
0161: public static final int SYNTAX_ERROR_1 = 42000;
0162:
0163: /**
0164: * The error with code <code>42001</code> is thrown when
0165: * trying to execute an invalid SQL statement.
0166: * Example:
0167: * <pre>
0168: * CREATE TABLE TEST(ID INT);
0169: * INSERT INTO TEST(1);
0170: * </pre>
0171: */
0172: public static final int SYNTAX_ERROR_2 = 42001;
0173:
0174: /**
0175: * The error with code <code>42101</code> is thrown when
0176: * trying to create a table or view if an object with this name already exists.
0177: * Example:
0178: * <pre>
0179: * CREATE TABLE TEST(ID INT);
0180: * CREATE TABLE TEST(ID INT PRIMARY KEY);
0181: * </pre>
0182: */
0183: public static final int TABLE_OR_VIEW_ALREADY_EXISTS_1 = 42101;
0184:
0185: /**
0186: * The error with code <code>42102</code> is thrown when
0187: * trying to query, modify or drop a table or view that does not exists
0188: * in this schema and database. A common cause is that the wrong
0189: * database was opened.
0190: * Example:
0191: * <pre>
0192: * SELECT * FROM ABC;
0193: * </pre>
0194: */
0195: public static final int TABLE_OR_VIEW_NOT_FOUND_1 = 42102;
0196:
0197: /**
0198: * The error with code <code>42111</code> is thrown when
0199: * trying to create an index if an index with the same name already exists.
0200: * Example:
0201: * <pre>
0202: * CREATE TABLE TEST(ID INT, NAME VARCHAR);
0203: * CREATE INDEX IDX_ID ON TEST(ID);
0204: * CREATE TABLE ADDRESS(ID INT);
0205: * CREATE INDEX IDX_ID ON ADDRESS(ID);
0206: * </pre>
0207: */
0208: public static final int INDEX_ALREADY_EXISTS_1 = 42111;
0209:
0210: /**
0211: * The error with code <code>42112</code> is thrown when
0212: * trying to drop or reference an index that does not exist.
0213: * Example:
0214: * <pre>
0215: * DROP INDEX ABC;
0216: * </pre>
0217: */
0218: public static final int INDEX_NOT_FOUND_1 = 42112;
0219:
0220: /**
0221: * The error with code <code>42121</code> is thrown when trying to create
0222: * a table or insert into a table and use the same column name twice.
0223: * Example:
0224: * <pre>
0225: * CREATE TABLE TEST(ID INT, ID INT);
0226: * </pre>
0227: */
0228: public static final int DUPLICATE_COLUMN_NAME_1 = 42121;
0229:
0230: /**
0231: * The error with code <code>42122</code> is thrown when
0232: * referencing an non-existing column.
0233: * Example:
0234: * <pre>
0235: * CREATE TABLE TEST(ID INT);
0236: * SELECT NAME FROM TEST;
0237: * </pre>
0238: */
0239: public static final int COLUMN_NOT_FOUND_1 = 42122;
0240:
0241: // 0A: feature not supported
0242:
0243: // HZ: remote database access
0244:
0245: //
0246: /**
0247: * The error with code <code>50000</code> is thrown when
0248: * something unexpected occurs, for example an internal stack
0249: * overflow. For details about the problem, see the cause of the
0250: * exception in the stack trace.
0251: */
0252: public static final int GENERAL_ERROR_1 = 50000;
0253:
0254: /**
0255: * The error with code <code>50004</code> is thrown when
0256: * creating a table with an unsupported data type, or
0257: * when the data type is unknown because parameters are used.
0258: * Example:
0259: * <pre>
0260: * CREATE TABLE TEST(ID VERYSMALLINT);
0261: * </pre>
0262: */
0263: public static final int UNKNOWN_DATA_TYPE_1 = 50004;
0264:
0265: /**
0266: * The error with code <code>50100</code> is thrown when
0267: * calling an unsupported JDBC method. See the stack trace
0268: * for details.
0269: */
0270: public static final int FEATURE_NOT_SUPPORTED = 50100;
0271:
0272: /**
0273: * The error with code <code>50200</code> is thrown when
0274: * another connection locked an object longer than the lock timeout
0275: * set for this connection, or when a deadlock occured.
0276: * Example:
0277: * <pre>
0278: * CREATE TABLE TEST(ID INT);
0279: * -- connection 1:
0280: * SET AUTOCOMMIT FALSE;
0281: * INSERT INTO TEST VALUES(1);
0282: * -- connection 2:
0283: * SET AUTOCOMMIT FALSE;
0284: * INSERT INTO TEST VALUES(1);
0285: * </pre>
0286: */
0287: public static final int LOCK_TIMEOUT_1 = 50200;
0288:
0289: /**
0290: * The error with code <code>90000</code> is thrown when
0291: * a function that does not return a result set was used in the FROM clause.
0292: * Example:
0293: * <pre>
0294: * SELECT * FROM SIN(1);
0295: * </pre>
0296: */
0297: public static final int FUNCTION_MUST_RETURN_RESULT_SET_1 = 90000;
0298:
0299: /**
0300: * The error with code <code>90001</code> is thrown when
0301: * Statement.executeUpdate() was called for a SELECT statement.
0302: * This is not allowed according to the JDBC specs.
0303: */
0304: public static final int METHOD_NOT_ALLOWED_FOR_QUERY = 90001;
0305:
0306: /**
0307: * The error with code <code>90002</code> is thrown when
0308: * Statement.executeQuery() was called for a statement that does
0309: * not return a result set (for example, an UPDATE statement).
0310: * This is not allowed according to the JDBC specs.
0311: */
0312: public static final int METHOD_ONLY_ALLOWED_FOR_QUERY = 90002;
0313:
0314: /**
0315: * The error with code <code>90003</code> is thrown when
0316: * trying to convert a String to a binary value. Two hex digits
0317: * per byte are required. Example:
0318: * <pre>
0319: * CALL X'00023';
0320: * Hexadecimal string with odd number of characters: 00023
0321: * </pre>
0322: * Correct:
0323: * <pre>
0324: * CALL X'000023';
0325: * </pre>
0326: */
0327: public static final int HEX_STRING_ODD_1 = 90003;
0328:
0329: /**
0330: * The error with code <code>90004</code> is thrown when
0331: * trying to convert a text to binary, but the expression contains
0332: * a non-hexadecimal character.
0333: * Example:
0334: * <pre>
0335: * CALL X'ABCDEFGH';
0336: * CALL CAST('ABCDEFGH' AS BINARY);
0337: * </pre>
0338: * Conversion from text to binary is supported, but the text must
0339: * represent the hexadecimal encoded bytes.
0340: */
0341: public static final int HEX_STRING_WRONG_1 = 90004;
0342:
0343: /**
0344: * The error with code <code>90005</code> is thrown when
0345: * trying to insert a value that is too long for the column.
0346: * Example:
0347: * <pre>
0348: * CREATE TABLE TEST(ID INT, NAME VARCHAR(2));
0349: * INSERT INTO TEST VALUES(1, 'Hello');
0350: * </pre>
0351: */
0352: public static final int VALUE_TOO_LONG_2 = 90005;
0353:
0354: /**
0355: * The error with code <code>90006</code> is thrown when
0356: * trying to insert NULL into a column that does not allow NULL.
0357: * Example:
0358: * <pre>
0359: * CREATE TABLE TEST(ID INT, NAME VARCHAR NOT NULL);
0360: * INSERT INTO TEST(ID) VALUES(1);
0361: * </pre>
0362: */
0363: public static final int NULL_NOT_ALLOWED = 90006;
0364:
0365: /**
0366: * The error with code <code>90007</code> is thrown when
0367: * trying to call a JDBC method on an object that has been closed.
0368: */
0369: public static final int OBJECT_CLOSED = 90007;
0370:
0371: /**
0372: * The error with code <code>90008</code> is thrown when
0373: * trying to use a value that is not valid for the given operation.
0374: * Example:
0375: * <pre>
0376: * CREATE SEQUENCE TEST INCREMENT 0;
0377: * </pre>
0378: */
0379: public static final int INVALID_VALUE_2 = 90008;
0380:
0381: /**
0382: * The error with code <code>90009</code> is thrown when
0383: * a text can not be converted to a date constant.
0384: * Example:
0385: * <pre>
0386: * CALL DATE '2007-January-01';
0387: * </pre>
0388: */
0389: public static final int DATE_CONSTANT_2 = 90009;
0390:
0391: /**
0392: * The error with code <code>90010</code> is thrown when
0393: * a text can not be converted to a time constant.
0394: * Example:
0395: * <pre>
0396: * CALL TIME '14:61:00';
0397: * </pre>
0398: */
0399: public static final int TIME_CONSTANT_2 = 90010;
0400:
0401: /**
0402: * The error with code <code>90011</code> is thrown when
0403: * a text can not be converted to a timestamp constant.
0404: * Example:
0405: * <pre>
0406: * CALL TIMESTAMP '2001-02-30 12:00:00';
0407: * </pre>
0408: */
0409: public static final int TIMESTAMP_CONSTANT_2 = 90011;
0410:
0411: /**
0412: * The error with code <code>90012</code> is thrown when
0413: * trying to execute a statement with an parameter.
0414: * Example:
0415: * <pre>
0416: * CALL SIN(?);
0417: * </pre>
0418: */
0419: public static final int PARAMETER_NOT_SET_1 = 90012;
0420:
0421: /**
0422: * The error with code <code>90013</code> is thrown when
0423: * trying to open a database that does not exist using the flag IFEXISTS=TRUE,
0424: * or when trying to access a database object with a catalog name that does
0425: * not match the database name.
0426: * Example:
0427: * <pre>
0428: * CREATE TABLE TEST(ID INT);
0429: * SELECT XYZ.PUBLIC.TEST.ID FROM TEST;
0430: * </pre>
0431: */
0432: public static final int DATABASE_NOT_FOUND_1 = 90013;
0433:
0434: /**
0435: * The error with code <code>90014</code> is thrown when
0436: * trying to parse a date with an unsupported format string, or
0437: * when the date can not be parsed.
0438: * Example:
0439: * <pre>
0440: * CALL PARSEDATETIME('2001 January', 'yyyy mm');
0441: * </pre>
0442: */
0443: public static final int PARSE_ERROR_1 = 90014;
0444:
0445: /**
0446: * The error with code <code>90015</code> is thrown when
0447: * using an aggregate function with a data type that is not supported.
0448: * Example:
0449: * <pre>
0450: * SELECT SUM('Hello') FROM DUAL;
0451: * </pre>
0452: */
0453: public static final int SUM_OR_AVG_ON_WRONG_DATATYPE_1 = 90015;
0454:
0455: /**
0456: * The error with code <code>90016</code> is thrown when
0457: * a column was used in the expression list or the order by clause
0458: * of a group or aggregate query, and that column is not in the GROUP BY clause.
0459: * Example:
0460: * <pre>
0461: * CREATE TABLE TEST(ID INT, NAME VARCHAR);
0462: * INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');
0463: * SELECT ID, MAX(NAME) FROM TEST;
0464: * Column ID must be in the GROUP BY list.
0465: * </pre>
0466: * Correct:
0467: * <pre>
0468: * SELECT ID, MAX(NAME) FROM TEST GROUP BY ID;
0469: * </pre>
0470: */
0471: public static final int MUST_GROUP_BY_COLUMN_1 = 90016;
0472:
0473: /**
0474: * The error with code <code>90017</code> is thrown when
0475: * trying to define a second primary key constraint for this table.
0476: * Example:
0477: * <pre>
0478: * CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
0479: * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(NAME);
0480: * </pre>
0481: */
0482: public static final int SECOND_PRIMARY_KEY = 90017;
0483:
0484: /**
0485: * The error with code <code>90018</code> is thrown when
0486: * the connection was opened, but never closed. In the finalizer of the
0487: * connection, this forgotten close was detected and the connection was
0488: * closed automatically, but relying on the finalizer is not good practice
0489: * as it is not guaranteed and behavior is virtual machine dependent. The
0490: * application should close the connection. This exception only appears in
0491: * the .trace.db file. Example:
0492: * <pre>
0493: * Connection conn;
0494: * conn = DriverManager.getConnection("jdbc:h2:˜/test");
0495: * conn = null;
0496: * The connection was not closed by the application and is
0497: * garbage collected
0498: * </pre>
0499: * Correct:
0500: * <pre>
0501: * conn.close();
0502: * </pre>
0503: */
0504: public static final int TRACE_CONNECTION_NOT_CLOSED = 90018;
0505:
0506: /**
0507: * The error with code <code>90019</code> is thrown when
0508: * trying to drop the current user.
0509: * Example:
0510: * <pre>
0511: * DROP USER SA;
0512: * </pre>
0513: */
0514: public static final int CANNOT_DROP_CURRENT_USER = 90019;
0515:
0516: /**
0517: * The error with code <code>90020</code> is thrown when trying to open a
0518: * database in embedded mode if this database is already in use in another
0519: * process (or in a different class loader). Multiple connections to the
0520: * same database are supported in the following cases:
0521: * <ul><li>In embedded mode (URL of the form jdbc:h2:~/test) if all
0522: * connections are opened within the same process and class loader.
0523: * </li><li>In server and cluster mode (URL of the form
0524: * jdbc:h2:tcp://localhost/test) using remote connections.
0525: * </li></ul>
0526: * The mixed mode is also supported. This mode requires to start a server
0527: * in the same process where the database is open in embedded mode.
0528: */
0529: public static final int DATABASE_ALREADY_OPEN_1 = 90020;
0530:
0531: /**
0532: * The error with code <code>90021</code> is thrown when
0533: * trying to convert a value to a data type where the conversion is undefined,
0534: * or when an error occured trying to convert.
0535: * Example:
0536: * <pre>
0537: * CALL CAST(DATE '2001-01-01' AS BOOLEAN);
0538: * CALL CAST('CHF 99.95' AS INT);
0539: * </pre>
0540: */
0541: public static final int DATA_CONVERSION_ERROR_1 = 90021;
0542:
0543: /**
0544: * The error with code <code>90022</code> is thrown when
0545: * trying to call a unknown function.
0546: * Example:
0547: * <pre>
0548: * CALL SPECIAL_SIN(10);
0549: * </pre>
0550: */
0551: public static final int FUNCTION_NOT_FOUND_1 = 90022;
0552:
0553: /**
0554: * The error with code <code>90023</code> is thrown when
0555: * trying to set a primary key on a nullable column.
0556: * Example:
0557: * <pre>
0558: * CREATE TABLE TEST(ID INT, NAME VARCHAR);
0559: * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(ID);
0560: * </pre>
0561: */
0562: public static final int COLUMN_MUST_NOT_BE_NULLABLE_1 = 90023;
0563:
0564: /**
0565: * The error with code <code>90024</code> is thrown when
0566: * a file could not be renamed.
0567: */
0568: public static final int FILE_RENAME_FAILED_2 = 90024;
0569:
0570: /**
0571: * The error with code <code>90025</code> is thrown when
0572: * a file could not be deleted, because it is still in use
0573: * (only in Windows), or because an error occured when deleting.
0574: */
0575: public static final int FILE_DELETE_FAILED_1 = 90025;
0576:
0577: /**
0578: * The error with code <code>90026</code> is thrown when
0579: * an object could not be serialized.
0580: */
0581: public static final int SERIALIZATION_FAILED_1 = 90026;
0582:
0583: /**
0584: * The error with code <code>90027</code> is thrown when
0585: * an object could not be de-serialized.
0586: */
0587: public static final int DESERIALIZATION_FAILED_1 = 90027;
0588:
0589: /**
0590: * The error with code <code>90028</code> is thrown when
0591: * an input / output error occured. For more information, see the root
0592: * cause of the exception.
0593: */
0594: public static final int IO_EXCEPTION_1 = 90028;
0595:
0596: /**
0597: * The error with code <code>90029</code> is thrown when
0598: * calling ResultSet.deleteRow(), insertRow(), or updateRow()
0599: * when the current row is not updatable.
0600: * Example:
0601: * <pre>
0602: * ResultSet rs = stat.executeQuery("SELECT * FROM TEST");
0603: * rs.next();
0604: * rs.insertRow();
0605: * </pre>
0606: */
0607: public static final int NOT_ON_UPDATABLE_ROW = 90029;
0608:
0609: /**
0610: * The error with code <code>90030</code> is thrown when
0611: * the database engine has detected a checksum mismatch in the data
0612: * or index. To solve this problem, restore a backup or use the
0613: * Recovery tool (org.h2.tools.Recover).
0614: */
0615: public static final int FILE_CORRUPTED_1 = 90030;
0616:
0617: /**
0618: * The error with code <code>90031</code> is thrown when
0619: * an input / output error occured. For more information, see the root
0620: * cause of the exception.
0621: */
0622: public static final int IO_EXCEPTION_2 = 90031;
0623:
0624: /**
0625: * The error with code <code>90032</code> is thrown when
0626: * trying to drop or alter a user that does not exist.
0627: * Example:
0628: * <pre>
0629: * DROP USER TEST_USER;
0630: * </pre>
0631: */
0632: public static final int USER_NOT_FOUND_1 = 90032;
0633:
0634: /**
0635: * The error with code <code>90033</code> is thrown when
0636: * trying to create a user or role if a user with this name already exists.
0637: * Example:
0638: * <pre>
0639: * CREATE USER TEST_USER;
0640: * CREATE USER TEST_USER;
0641: * </pre>
0642: */
0643: public static final int USER_ALREADY_EXISTS_1 = 90033;
0644:
0645: /**
0646: * The error with code <code>90034</code> is thrown when
0647: * writing to the trace file failed, for example because the there
0648: * is an I/O exception. This message is printed to System.out,
0649: * but only once.
0650: */
0651: public static final int TRACE_FILE_ERROR_2 = 90034;
0652:
0653: /**
0654: * The error with code <code>90035</code> is thrown when
0655: * trying to create a sequence if a sequence with this name already
0656: * exists.
0657: * Example:
0658: * <pre>
0659: * CREATE SEQUENCE TEST_SEQ;
0660: * CREATE SEQUENCE TEST_SEQ;
0661: * </pre>
0662: */
0663: public static final int SEQUENCE_ALREADY_EXISTS_1 = 90035;
0664:
0665: /**
0666: * The error with code <code>90036</code> is thrown when
0667: * trying to access a sequence that does not exist.
0668: * Example:
0669: * <pre>
0670: * SELECT NEXT VALUE FOR SEQUENCE XYZ;
0671: * </pre>
0672: */
0673: public static final int SEQUENCE_NOT_FOUND_1 = 90036;
0674:
0675: /**
0676: * The error with code <code>90037</code> is thrown when
0677: * trying to drop or alter a view that does not exist.
0678: * Example:
0679: * <pre>
0680: * DROP VIEW XYZ;
0681: * </pre>
0682: */
0683: public static final int VIEW_NOT_FOUND_1 = 90037;
0684:
0685: /**
0686: * The error with code <code>90038</code> is thrown when
0687: * trying to create a view if a view with this name already
0688: * exists.
0689: * Example:
0690: * <pre>
0691: * CREATE VIEW DUMMY AS SELECT * FROM DUAL;
0692: * CREATE VIEW DUMMY AS SELECT * FROM DUAL;
0693: * </pre>
0694: */
0695: public static final int VIEW_ALREADY_EXISTS_1 = 90038;
0696:
0697: /**
0698: * The error with code <code>90039</code> is thrown when
0699: * trying to convert a decimal value to lower precision if the
0700: * value is out of range for this precision.
0701: * Example:
0702: * <pre>
0703: * SELECT * FROM TABLE(X DECIMAL(2, 2) = (123.34));
0704: * </pre>
0705: */
0706: public static final int VALUE_TOO_LARGE_FOR_PRECISION_1 = 90039;
0707:
0708: /**
0709: * The error with code <code>90040</code> is thrown when
0710: * a user that is not administrator tries to execute a statement
0711: * that requires admin privileges.
0712: */
0713: public static final int ADMIN_RIGHTS_REQUIRED = 90040;
0714:
0715: /**
0716: * The error with code <code>90041</code> is thrown when
0717: * trying to create a trigger and there is already a trigger with that name.
0718: * <pre>
0719: * CREATE TABLE TEST(ID INT);
0720: * CREATE TRIGGER TRIGGER_A AFTER INSERT ON TEST
0721: * CALL "org.h2.samples.TriggerSample$MyTrigger";
0722: * CREATE TRIGGER TRIGGER_A AFTER INSERT ON TEST
0723: * CALL "org.h2.samples.TriggerSample$MyTrigger";
0724: * </pre>
0725: */
0726: public static final int TRIGGER_ALREADY_EXISTS_1 = 90041;
0727:
0728: /**
0729: * The error with code <code>90042</code> is thrown when
0730: * trying to drop a trigger that does not exist.
0731: * Example:
0732: * <pre>
0733: * DROP TRIGGER TRIGGER_XYZ;
0734: * </pre>
0735: */
0736: public static final int TRIGGER_NOT_FOUND_1 = 90042;
0737:
0738: /**
0739: * The error with code <code>90043</code> is thrown when
0740: * there is an error initializing the trigger, for example because the
0741: * class does not implement the Trigger interface.
0742: * See the root cause for details.
0743: * Example:
0744: * <pre>
0745: * CREATE TABLE TEST(ID INT);
0746: * CREATE TRIGGER TRIGGER_A AFTER INSERT ON TEST
0747: * CALL "java.lang.String";
0748: * </pre>
0749: */
0750: public static final int ERROR_CREATING_TRIGGER_OBJECT_3 = 90043;
0751:
0752: /**
0753: * The error with code <code>90044</code> is thrown when
0754: * an exception or error occured while calling the triggers fire method.
0755: * See the root cause for details.
0756: */
0757: public static final int ERROR_EXECUTING_TRIGGER_3 = 90044;
0758:
0759: /**
0760: * The error with code <code>90045</code> is thrown when
0761: * trying to create a constraint if an object with this name already exists.
0762: * Example:
0763: * <pre>
0764: * CREATE TABLE TEST(ID INT NOT NULL);
0765: * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(ID);
0766: * ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY(ID);
0767: * </pre>
0768: */
0769: public static final int CONSTRAINT_ALREADY_EXISTS_1 = 90045;
0770:
0771: /**
0772: * The error with code <code>90046</code> is thrown when
0773: * trying to open a connection to a database using an unsupported URL format.
0774: * Please see the documentation on the supported URL format and examples.
0775: * Example:
0776: * <pre>
0777: * jdbc:h2:;;
0778: * </pre>
0779: */
0780: public static final int URL_FORMAT_ERROR_2 = 90046;
0781:
0782: /**
0783: * The error with code <code>90047</code> is thrown when
0784: * trying to connect to a TCP server with an incompatible client.
0785: */
0786: public static final int DRIVER_VERSION_ERROR_2 = 90047;
0787:
0788: /**
0789: * The error with code <code>90048</code> is thrown when
0790: * the file header of a database files (*.db) does not match the
0791: * expected version, or if it is corrupted.
0792: */
0793: public static final int FILE_VERSION_ERROR_1 = 90048;
0794:
0795: /**
0796: * The error with code <code>90049</code> is thrown when
0797: * trying to open an encrypted database with the wrong file encryption
0798: * password or algorithm.
0799: */
0800: public static final int FILE_ENCRYPTION_ERROR_1 = 90049;
0801:
0802: /**
0803: * The error with code <code>90050</code> is thrown when trying to open an
0804: * encrypted database, but not separating the file password from the user
0805: * password. The file password is specified in the password field, before
0806: * the user password. A single space needs to be added between the file
0807: * password and the user password; the file password itself may not contain
0808: * spaces. File passwords (as well as user passwords) are case sensitive.
0809: * Example:
0810: * <pre>
0811: * String url = "jdbc:h2:˜/test;CIPHER=AES";
0812: * String passwords = "filePasswordUserPassword";
0813: * DriverManager.getConnection(url, "sa", pwds);
0814: * </pre>
0815: * Correct:
0816: * <pre>
0817: * String url = "jdbc:h2:˜/test;CIPHER=AES";
0818: * String passwords = "filePassword userPassword";
0819: * DriverManager.getConnection(url, "sa", pwds);
0820: * </pre>
0821: */
0822: public static final int WRONG_PASSWORD_FORMAT = 90050;
0823:
0824: /**
0825: * The error with code <code>90051</code> is thrown when
0826: * a statement was cancelled using Statement.cancel() or
0827: * when the query timeout has been reached.
0828: * Examples:
0829: * <pre>
0830: * stat.setQueryTimeout(1);
0831: * stat.cancel();
0832: * </pre>
0833: */
0834: public static final int STATEMENT_WAS_CANCELLED = 90051;
0835:
0836: /**
0837: * The error with code <code>90052</code> is thrown when
0838: * a subquery that is used as a value contains more than one column.
0839: * Example:
0840: * <pre>
0841: * CREATE TABLE TEST(ID INT);
0842: * INSERT INTO TEST VALUES(1), (2);
0843: * SELECT * FROM TEST WHERE ID IN (SELECT 1, 2 FROM DUAL);
0844: * </pre>
0845: * Correct:
0846: * <pre>
0847: * CREATE TABLE TEST(ID INT);
0848: * INSERT INTO TEST VALUES(1), (2);
0849: * SELECT * FROM TEST WHERE ID IN (1, 2);
0850: * </pre>
0851: */
0852: public static final int SUBQUERY_IS_NOT_SINGLE_COLUMN = 90052;
0853:
0854: /**
0855: * The error with code <code>90053</code> is thrown when
0856: * a subquery that is used as a value contains more than one row.
0857: * Example:
0858: * <pre>
0859: * CREATE TABLE TEST(ID INT, NAME VARCHAR);
0860: * INSERT INTO TEST VALUES(1, 'Hello'), (1, 'World');
0861: * SELECT X, (SELECT NAME FROM TEST WHERE ID=X) FROM DUAL;
0862: * </pre>
0863: */
0864: public static final int SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW = 90053;
0865:
0866: /**
0867: * The error with code <code>90054</code> is thrown when
0868: * an aggregate function is used where it is not allowed.
0869: * Example:
0870: * <pre>
0871: * CREATE TABLE TEST(ID INT);
0872: * INSERT INTO TEST VALUES(1), (2);
0873: * SELECT MAX(ID) FROM TEST WHERE ID = MAX(ID) GROUP BY ID;
0874: * </pre>
0875: */
0876: public static final int INVALID_USE_OF_AGGREGATE_FUNCTION_1 = 90054;
0877:
0878: /**
0879: * The error with code <code>90055</code> is thrown when
0880: * trying to open a database with an unsupported cipher algorithm.
0881: * Supported are AES and XTEA.
0882: * Example:
0883: * <pre>
0884: * jdbc:h2:~/test;CIPHER=DES
0885: * </pre>
0886: */
0887: public static final int UNSUPPORTED_CIPHER = 90055;
0888:
0889: /**
0890: * The error with code <code>90056</code> is thrown when
0891: * updating or deleting from a table with a foreign key constraint
0892: * that should set the default value, but there is no default value defined.
0893: * Example:
0894: * <pre>
0895: * CREATE TABLE TEST(ID INT, PARENT INT);
0896: * INSERT INTO TEST VALUES(1, 1), (2, 1);
0897: * ALTER TABLE TEST ADD CONSTRAINT TEST_ID_PARENT
0898: * FOREIGN KEY(PARENT) REFERENCES(ID) ON DELETE SET DEFAULT;
0899: * DELETE FROM TEST WHERE ID=1;
0900: * </pre>
0901: */
0902: public static final int NO_DEFAULT_SET_1 = 90056;
0903:
0904: /**
0905: * The error with code <code>90057</code> is thrown when
0906: * trying to drop a constraint that does not exist.
0907: * Example:
0908: * <pre>
0909: * CREATE TABLE TEST(ID INT);
0910: * ALTER TABLE TEST DROP CONSTRAINT CID;
0911: * </pre>
0912: */
0913: public static final int CONSTRAINT_NOT_FOUND_1 = 90057;
0914:
0915: /**
0916: * The error with code <code>90058</code> is thrown when trying to call
0917: * commit or rollback inside a trigger, or when trying to call a method
0918: * inside a trigger that implicitly commits the current transaction, if an
0919: * object is locked. This is not because it would release the lock too
0920: * early.
0921: */
0922: public static final int COMMIT_ROLLBACK_NOT_ALLOWED = 90058;
0923:
0924: /**
0925: * The error with code <code>90059</code> is thrown when
0926: * a query contains a column that could belong to multiple tables.
0927: * Example:
0928: * <pre>
0929: * CREATE TABLE PARENT(ID INT, NAME VARCHAR);
0930: * CREATE TABLE CHILD(PID INT, NAME VARCHAR);
0931: * SELECT ID, NAME FROM PARENT P, CHILD C WHERE P.ID = C.PID;
0932: * </pre>
0933: */
0934: public static final int AMBIGUOUS_COLUMN_NAME_1 = 90059;
0935:
0936: /**
0937: * The error with code <code>90060</code> is thrown when
0938: * trying to use a file locking mechanism that is not supported.
0939: * Currently only FILE (the default) and SOCKET are supported
0940: * Example:
0941: * <pre>
0942: * jdbc:h2:~/test;FILE_LOCK=LDAP
0943: * </pre>
0944: */
0945: public static final int UNSUPPORTED_LOCK_METHOD_1 = 90060;
0946:
0947: /**
0948: * The error with code <code>90061</code> is thrown when
0949: * trying to start a server if a server is already running on the same port.
0950: * It could also be a firewall problem.
0951: */
0952: public static final int EXCEPTION_OPENING_PORT_2 = 90061;
0953:
0954: /**
0955: * The error with code <code>90062</code> is thrown when
0956: * a directory or file could not be created. This can occur when
0957: * trying to create a directory if a file with the same name already
0958: * exists, or vice versa.
0959: *
0960: */
0961: public static final int FILE_CREATION_FAILED_1 = 90062;
0962:
0963: /**
0964: * The error with code <code>90063</code> is thrown when
0965: * trying to rollback to a savepoint that is not defined.
0966: * Example:
0967: * <pre>
0968: * ROLLBACK TO SAVEPOINT S_UNKNOWN;
0969: * </pre>
0970: */
0971: public static final int SAVEPOINT_IS_INVALID_1 = 90063;
0972:
0973: /**
0974: * The error with code <code>90064</code> is thrown when
0975: * Savepoint.getSavepointName() is called on an unnamed savepoint.
0976: * Example:
0977: * <pre>
0978: * Savepoint sp = conn.setSavepoint();
0979: * sp.getSavepointName();
0980: * </pre>
0981: */
0982: public static final int SAVEPOINT_IS_UNNAMED = 90064;
0983:
0984: /**
0985: * The error with code <code>90065</code> is thrown when
0986: * Savepoint.getSavepointId() is called on a named savepoint.
0987: * Example:
0988: * <pre>
0989: * Savepoint sp = conn.setSavepoint("Joe");
0990: * sp.getSavepointId();
0991: * </pre>
0992: */
0993: public static final int SAVEPOINT_IS_NAMED = 90065;
0994:
0995: /**
0996: * The error with code <code>90066</code> is thrown when
0997: * the same property appears twice in the database URL or in
0998: * the connection properties.
0999: * Example:
1000: * <pre>
1001: * jdbc:h2:~/test;LOG=0;LOG=1
1002: * </pre>
1003: */
1004: public static final int DUPLICATE_PROPERTY_1 = 90066;
1005:
1006: /**
1007: * The error with code <code>90067</code> is thrown when
1008: * the connection to the database is lost. A possible reason
1009: * is that the connection has been closed due to a shutdown,
1010: * or that the server is stopped.
1011: */
1012: public static final int CONNECTION_BROKEN = 90067;
1013:
1014: /**
1015: * The error with code <code>90068</code> is thrown when the given
1016: * expression that is used in the ORDER BY is not in the result list. This
1017: * is required for distinct queries, otherwise the result would be
1018: * ambiguous.
1019: * <pre>
1020: * CREATE TABLE TEST(ID INT, NAME VARCHAR);
1021: * INSERT INTO TEST VALUES(2, 'Hello'), (1, 'Hello');
1022: * SELECT DISTINCT NAME FROM TEST ORDER BY ID;
1023: * Order by expression ID must be in the result list in this case
1024: * </pre>
1025: * Correct:
1026: * <pre>
1027: * SELECT DISTINCT ID, NAME FROM TEST ORDER BY ID;
1028: * </pre>
1029: */
1030: public static final int ORDER_BY_NOT_IN_RESULT = 90068;
1031:
1032: /**
1033: * The error with code <code>90069</code> is thrown when
1034: * trying to create a role if an object with this name already exists.
1035: * Example:
1036: * <pre>
1037: * CREATE ROLE TEST_ROLE;
1038: * CREATE ROLE TEST_ROLE;
1039: * </pre>
1040: */
1041: public static final int ROLE_ALREADY_EXISTS_1 = 90069;
1042:
1043: /**
1044: * The error with code <code>90070</code> is thrown when
1045: * trying to drop or grant a role that does not exists.
1046: * Example:
1047: * <pre>
1048: * DROP ROLE TEST_ROLE_2;
1049: * </pre>
1050: */
1051: public static final int ROLE_NOT_FOUND_1 = 90070;
1052:
1053: /**
1054: * The error with code <code>90071</code> is thrown when
1055: * trying to grant or revoke if no role or user with that name exists.
1056: * Example:
1057: * <pre>
1058: * GRANT SELECT ON TEST TO UNKNOWN;
1059: * </pre>
1060: */
1061: public static final int USER_OR_ROLE_NOT_FOUND_1 = 90071;
1062:
1063: /**
1064: * The error with code <code>90072</code> is thrown when
1065: * trying to grant or revoke if no role or user with that name exists.
1066: * Example:
1067: * <pre>
1068: * GRANT SELECT, TEST_ROLE ON TEST TO SA;
1069: * </pre>
1070: */
1071: public static final int ROLES_AND_RIGHT_CANNOT_BE_MIXED = 90072;
1072:
1073: /**
1074: * The error with code <code>90073</code> is thrown when
1075: * trying to revoke a right that does not or no longer exist.
1076: * Example:
1077: * <pre>
1078: * CREATE USER TEST_USER PASSWORD 'abc';
1079: * REVOKE SELECT ON TEST FROM TEST_USER;
1080: * </pre>
1081: */
1082: public static final int RIGHT_NOT_FOUND = 90073;
1083:
1084: /**
1085: * The error with code <code>90074</code> is thrown when
1086: * trying to grant a role that has already been granted.
1087: * Example:
1088: * <pre>
1089: * CREATE ROLE TEST_ROLE;
1090: * GRANT TEST_ROLE TO SA;
1091: * GRANT TEST_ROLE TO SA;
1092: * </pre>
1093: */
1094: public static final int ROLE_ALREADY_GRANTED_1 = 90074;
1095:
1096: /**
1097: * The error with code <code>90075</code> is thrown when
1098: * trying to alter a table and allow null for a column that is part of a
1099: * primary key or hash index.
1100: * Example:
1101: * <pre>
1102: * CREATE TABLE TEST(ID INT PRIMARY KEY);
1103: * ALTER TABLE TEST ALTER COLUMN ID NULL;
1104: * </pre>
1105: */
1106: public static final int COLUMN_IS_PART_OF_INDEX_1 = 90075;
1107:
1108: /**
1109: * The error with code <code>90076</code> is thrown when
1110: * trying to create a function alias for a system function or for a function
1111: * that is already defined.
1112: * Example:
1113: * <pre>
1114: * CREATE ALIAS SQRT FOR "java.lang.Math.sqrt"
1115: * </pre>
1116: */
1117: public static final int FUNCTION_ALIAS_ALREADY_EXISTS_1 = 90076;
1118:
1119: /**
1120: * The error with code <code>90077</code> is thrown when
1121: * trying to drop a system function or a function alias that does not exist.
1122: * Example:
1123: * <pre>
1124: * DROP ALIAS SQRT;
1125: * </pre>
1126: */
1127: public static final int FUNCTION_ALIAS_NOT_FOUND_1 = 90077;
1128:
1129: /**
1130: * The error with code <code>90078</code> is thrown when
1131: * trying to create a schema if an object with this name already exists.
1132: * Example:
1133: * <pre>
1134: * CREATE SCHEMA TEST_SCHEMA;
1135: * CREATE SCHEMA TEST_SCHEMA;
1136: * </pre>
1137: */
1138: public static final int SCHEMA_ALREADY_EXISTS_1 = 90078;
1139:
1140: /**
1141: * The error with code <code>90079</code> is thrown when
1142: * trying to drop a schema that does not exist.
1143: * Example:
1144: * <pre>
1145: * DROP SCHEMA UNKNOWN;
1146: * </pre>
1147: */
1148: public static final int SCHEMA_NOT_FOUND_1 = 90079;
1149:
1150: /**
1151: * The error with code <code>90080</code> is thrown when
1152: * trying to rename a object to a different schema, or when trying to
1153: * create a related object in another schema.
1154: * Example:
1155: * <pre>
1156: * CREATE SCHEMA TEST_SCHEMA;
1157: * CREATE TABLE TEST(ID INT);
1158: * CREATE INDEX TEST_ID ON TEST(ID);
1159: * ALTER INDEX TEST_ID RENAME TO TEST_SCHEMA.IDX_TEST_ID;
1160: * </pre>
1161: */
1162: public static final int SCHEMA_NAME_MUST_MATCH = 90080;
1163:
1164: /**
1165: * The error with code <code>90081</code> is thrown when
1166: * trying to alter a column to not allow NULL, if there
1167: * is already data in the table where this column is NULL.
1168: * Example:
1169: * <pre>
1170: * CREATE TABLE TEST(ID INT);
1171: * INSERT INTO TEST VALUES(NULL);
1172: * ALTER TABLE TEST ALTER COLUMN ID VARCHAR NOT NULL;
1173: * </pre>
1174: */
1175: public static final int COLUMN_CONTAINS_NULL_VALUES_1 = 90081;
1176:
1177: /**
1178: * The error with code <code>90082</code> is thrown when
1179: * trying to drop a system generated sequence.
1180: */
1181: public static final int SEQUENCE_BELONGS_TO_A_TABLE_1 = 90082;
1182:
1183: /**
1184: * The error with code <code>90083</code> is thrown when
1185: * trying to drop a column that is part of a constraint.
1186: * Example:
1187: * <pre>
1188: * CREATE TABLE TEST(ID INT, PID INT REFERENCES(ID));
1189: * ALTER TABLE TEST DROP COLUMN PID;
1190: * </pre>
1191: */
1192: public static final int COLUMN_MAY_BE_REFERENCED_1 = 90083;
1193:
1194: /**
1195: * The error with code <code>90084</code> is thrown when
1196: * trying to drop the last column of a table.
1197: * Example:
1198: * <pre>
1199: * CREATE TABLE TEST(ID INT);
1200: * ALTER TABLE TEST DROP COLUMN ID;
1201: * </pre>
1202: */
1203: public static final int CANNOT_DROP_LAST_COLUMN = 90084;
1204:
1205: /**
1206: * The error with code <code>90085</code> is thrown when trying to
1207: * manually drop an index that was generated by the system because of a
1208: * unique constraint.
1209: * <pre>
1210: * CREATE TABLE TEST(ID INT, CONSTRAINT UID UNIQUE(ID));
1211: * DROP INDEX UID_INDEX_0;
1212: * Index UID_INDEX_0 belongs to a constraint
1213: * </pre>
1214: * Correct:
1215: * <pre>
1216: * ALTER TABLE TEST DROP CONSTRAINT UID;
1217: * </pre>
1218: */
1219: public static final int INDEX_BELONGS_TO_CONSTRAINT_1 = 90085;
1220:
1221: /**
1222: * The error with code <code>90086</code> is thrown when
1223: * a class can not be loaded because it is not in the classpath
1224: * or because a related class is not in the classpath.
1225: * Example:
1226: * <pre>
1227: * CREATE ALIAS TEST FOR "java.lang.invalid.Math.sqrt";
1228: * </pre>
1229: */
1230: public static final int CLASS_NOT_FOUND_1 = 90086;
1231:
1232: /**
1233: * The error with code <code>90087</code> is thrown when
1234: * the specified method was not found in the class.
1235: * Example:
1236: * <pre>
1237: * CREATE ALIAS TEST FOR "java.lang.Math.test";
1238: * </pre>
1239: */
1240: public static final int METHOD_NOT_FOUND_1 = 90087;
1241:
1242: /**
1243: * The error with code <code>90088</code> is thrown when
1244: * trying to switch to an unknown mode.
1245: * Example:
1246: * <pre>
1247: * SET MODE UNKNOWN;
1248: * </pre>
1249: */
1250: public static final int UNKNOWN_MODE_1 = 90088;
1251:
1252: /**
1253: * The error with code <code>90089</code> is thrown when
1254: * trying to change the collation while there was already data in
1255: * the database. The collation of the database must be set when the
1256: * database is empty.
1257: * Example:
1258: * <pre>
1259: * CREATE TABLE TEST(NAME VARCHAR PRIMARY KEY);
1260: * INSERT INTO TEST VALUES('Hello', 'World');
1261: * SET COLLATION DE;
1262: * Collation cannot be changed because there is a data table: PUBLIC.TEST
1263: * </pre>
1264: * Correct:
1265: * <pre>
1266: * SET COLLATION DE;
1267: * CREATE TABLE TEST(NAME VARCHAR PRIMARY KEY);
1268: * INSERT INTO TEST VALUES('Hello', 'World');
1269: * </pre>
1270: */
1271: public static final int COLLATION_CHANGE_WITH_DATA_TABLE_1 = 90089;
1272:
1273: /**
1274: * The error with code <code>90090</code> is thrown when
1275: * trying to drop a schema that may not be dropped (the schema PUBLIC
1276: * and the schema INFORMATION_SCHEMA).
1277: * Example:
1278: * <pre>
1279: * DROP SCHEMA PUBLIC;
1280: * </pre>
1281: */
1282: public static final int SCHEMA_CAN_NOT_BE_DROPPED_1 = 90090;
1283:
1284: /**
1285: * The error with code <code>90091</code> is thrown when
1286: * trying to drop the role PUBLIC.
1287: * Example:
1288: * <pre>
1289: * DROP ROLE PUBLIC;
1290: * </pre>
1291: */
1292: public static final int ROLE_CAN_NOT_BE_DROPPED_1 = 90091;
1293:
1294: /**
1295: * The error with code <code>90092</code> is thrown when
1296: * the source code is not compiled for the Java platform used.
1297: * At runtime, the existence of the class java.sql.Savepoint is checked.
1298: * To run this database in JDK 1.3, it is first required to switch the
1299: * source code to JDK 1.3 using ant codeswitchJdk13.
1300: */
1301: public static final int UNSUPPORTED_JAVA_VERSION = 90092;
1302:
1303: /**
1304: * The error with code <code>90093</code> is thrown when
1305: * trying to connect to a clustered database that runs in standalone
1306: * mode. This can happen if clustering is not enabled on the database,
1307: * or if one of the clients disabled clustering because it can not see
1308: * the other cluster node.
1309: */
1310: public static final int CLUSTER_ERROR_DATABASE_RUNS_ALONE = 90093;
1311:
1312: /**
1313: * The error with code <code>90094</code> is thrown when
1314: * trying to connect to a clustered database that runs together with a
1315: * different cluster node setting than what is used when trying to connect.
1316: */
1317: public static final int CLUSTER_ERROR_DATABASE_RUNS_CLUSTERED_1 = 90094;
1318:
1319: /**
1320: * The error with code <code>90095</code> is thrown when
1321: * calling the method STRINGDECODE with an invalid escape sequence.
1322: * Only Java style escape sequences and Java properties file escape
1323: * sequences are supported.
1324: * Example:
1325: * <pre>
1326: * CALL STRINGDECODE('\i');
1327: * </pre>
1328: */
1329: public static final int STRING_FORMAT_ERROR_1 = 90095;
1330:
1331: /**
1332: * The error with code <code>90096</code> is thrown when
1333: * trying to perform an operation with a non-admin user if the
1334: * user does not have enough rights.
1335: */
1336: public static final int NOT_ENOUGH_RIGHTS_FOR_1 = 90096;
1337:
1338: /**
1339: * The error with code <code>90097</code> is thrown when
1340: * trying to delete or update a database if it is open in read-only mode.
1341: * Example:
1342: * <pre>
1343: * jdbc:h2:~/test;ACCESS_MODE_DATA=R
1344: * CREATE TABLE TEST(ID INT);
1345: * </pre>
1346: */
1347: public static final int DATABASE_IS_READ_ONLY = 90097;
1348:
1349: /**
1350: * The error with code <code>90098</code> is thrown when the
1351: * self-destruction counter has reached zero. This counter is only used for
1352: * recovery testing, and not set in normal operation.
1353: */
1354: public static final int SIMULATED_POWER_OFF = 90098;
1355:
1356: /**
1357: * The error with code <code>90099</code> is thrown when an error occured
1358: * trying to initialize the database event listener. Example:
1359: * <pre>
1360: * jdbc:h2:˜/test;DATABASE_EVENT_LISTENER='java.lang.String'
1361: * </pre>
1362: */
1363: public static final int ERROR_SETTING_DATABASE_EVENT_LISTENER_2 = 90099;
1364:
1365: /**
1366: * The error with code <code>90100</code> is thrown when
1367: * there is no more space available on the device where the database
1368: * files are stored.
1369: */
1370: public static final int NO_DISK_SPACE_AVAILABLE = 90100;
1371:
1372: /**
1373: * The error with code <code>90101</code> is thrown when
1374: * the XA API detected unsupported transaction names. This can happen
1375: * when mixing application generated transaction names and transaction names
1376: * generated by this databases XAConnection API.
1377: */
1378: public static final int WRONG_XID_FORMAT_1 = 90101;
1379:
1380: /**
1381: * The error with code <code>90102</code> is thrown when
1382: * trying to use unsupported options for the given compression algorithm.
1383: * Example:
1384: * <pre>
1385: * CALL COMPRESS(STRINGTOUTF8(SPACE(100)), 'DEFLATE l 10');
1386: * </pre>
1387: * Correct:
1388: * <pre>
1389: * CALL COMPRESS(STRINGTOUTF8(SPACE(100)), 'DEFLATE l 9');
1390: * </pre>
1391: */
1392: public static final int UNSUPPORTED_COMPRESSION_OPTIONS_1 = 90102;
1393:
1394: /**
1395: * The error with code <code>90103</code> is thrown when
1396: * trying to use an unsupported compression algorithm.
1397: * Example:
1398: * <pre>
1399: * CALL COMPRESS(STRINGTOUTF8(SPACE(100)), 'BZIP');
1400: * </pre>
1401: */
1402: public static final int UNSUPPORTED_COMPRESSION_ALGORITHM_1 = 90103;
1403:
1404: /**
1405: * The error with code <code>90104</code> is thrown when
1406: * the data can not be de-compressed.
1407: * Example:
1408: * <pre>
1409: * CALL EXPAND(X'00FF');
1410: * </pre>
1411: */
1412: public static final int COMPRESSION_ERROR = 90104;
1413:
1414: /**
1415: * The error with code <code>90105</code> is thrown when
1416: * an exception occured in a user defined method.
1417: * Example:
1418: * <pre>
1419: * CREATE ALIAS SYS_PROP FOR "java.lang.System.getProperty";
1420: * CALL SYS_PROP(NULL);
1421: * </pre>
1422: */
1423: public static final int EXCEPTION_IN_FUNCTION = 90105;
1424:
1425: /**
1426: * The error with code <code>90106</code> is thrown when
1427: * trying to truncate a table that can not be truncated.
1428: * Tables with referential integrity constraints can not be truncated.
1429: * Also, system tables and view can not be truncated.
1430: * Example:
1431: * <pre>
1432: * TRUNCATE TABLE INFORMATION_SCHEMA.SETTINGS;
1433: * </pre>
1434: */
1435: public static final int CANNOT_TRUNCATE_1 = 90106;
1436:
1437: /**
1438: * The error with code <code>90107</code> is thrown when
1439: * trying to drop an object because another object would become invalid.
1440: * Example:
1441: * <pre>
1442: * CREATE TABLE COUNT(X INT);
1443: * CREATE TABLE ITEMS(ID INT DEFAULT SELECT MAX(X)+1 FROM COUNT);
1444: * DROP TABLE COUNT;
1445: * </pre>
1446: */
1447: public static final int CANNOT_DROP_2 = 90107;
1448:
1449: /**
1450: * The error with code <code>90109</code> is thrown when
1451: * trying to run a query against an invalid view.
1452: * Example:
1453: * <pre>
1454: * CREATE FORCE VIEW TEST_VIEW AS SELECT * FROM TEST;
1455: * SELECT * FROM TEST_VIEW;
1456: * </pre>
1457: */
1458: public static final int VIEW_IS_INVALID_2 = 90109;
1459:
1460: /**
1461: * The error with code <code>90110</code> is thrown when
1462: * the result of the calculation does not fit in the given data type.
1463: * Example:
1464: * <pre>
1465: * CALL -CAST(-128 AS TINYINT);
1466: * </pre>
1467: */
1468: public static final int OVERFLOW_FOR_TYPE_1 = 90110;
1469:
1470: /**
1471: * The error with code <code>90111</code> is thrown when
1472: * an exception occured while accessing a linked table.
1473: */
1474: public static final int ERROR_ACCESSING_LINKED_TABLE_2 = 90111;
1475:
1476: /**
1477: * The error with code <code>90112</code> is thrown when a row was deleted
1478: * twice while locking was disabled. This is an intern exception that should
1479: * never be thrown to the application, because such deleted should be
1480: * detected and the resulting exception ignored inside the database engine.
1481: * <pre>
1482: * Row not found when trying to delete from index UID_INDEX_0
1483: * </pre>
1484: */
1485: public static final int ROW_NOT_FOUND_WHEN_DELETING_1 = 90112;
1486:
1487: /**
1488: * The error with code <code>90113</code> is thrown when
1489: * the database URL contains unsupported settings.
1490: * Example:
1491: * <pre>
1492: * jdbc:h2:~/test;UNKNOWN=TRUE
1493: * </pre>
1494: */
1495: public static final int UNSUPPORTED_SETTING_1 = 90113;
1496:
1497: /**
1498: * The error with code <code>90114</code> is thrown when
1499: * trying to create a constant if a constant with this name already exists.
1500: * Example:
1501: * <pre>
1502: * CREATE CONSTANT TEST VALUE 1;
1503: * CREATE CONSTANT TEST VALUE 1;
1504: * </pre>
1505: */
1506: public static final int CONSTANT_ALREADY_EXISTS_1 = 90114;
1507:
1508: /**
1509: * The error with code <code>90115</code> is thrown when
1510: * trying to drop a constant that does not exists.
1511: * Example:
1512: * <pre>
1513: * DROP CONSTANT UNKNOWN;
1514: * </pre>
1515: */
1516: public static final int CONSTANT_NOT_FOUND_1 = 90115;
1517:
1518: /**
1519: * The error with code <code>90116</code> is thrown when
1520: * trying use a literal in a SQL statement if literals are disabled.
1521: * If literals are disabled, use PreparedStatement and parameters instead
1522: * of literals in the SQL statement.
1523: * Example:
1524: * <pre>
1525: * SET ALLOW_LITERALS NONE;
1526: * CALL 1+1;
1527: * </pre>
1528: */
1529: public static final int LITERALS_ARE_NOT_ALLOWED = 90116;
1530:
1531: /**
1532: * The error with code <code>90117</code> is thrown when
1533: * trying to connect to a TCP server from another machine, if remote
1534: * connections are not allowed. To allow remote connections,
1535: * start the TCP server using the option -tcpAllowOthers true as in:
1536: * <pre>
1537: * java org.h2.tools.Server -tcp -tcpAllowOthers true
1538: * </pre>
1539: * Or, when starting the server from an application, use:
1540: * <pre>
1541: * Server server = Server.createTcpServer(new String[] {
1542: * "-tcpAllowOthers", "true" });
1543: * server.start();
1544: * </pre>
1545: */
1546: public static final int REMOTE_CONNECTION_NOT_ALLOWED = 90117;
1547:
1548: /**
1549: * The error with code <code>90118</code> is thrown when
1550: * trying to drop a table can not be dropped.
1551: * Example:
1552: * <pre>
1553: * DROP TABLE INFORMATION_SCHEMA.SETTINGS;
1554: * </pre>
1555: */
1556: public static final int CANNOT_DROP_TABLE_1 = 90118;
1557:
1558: /**
1559: * The error with code <code>90119</code> is thrown when
1560: * trying to create a domain if an object with this name already exists.
1561: * Example:
1562: * <pre>
1563: * CREATE DOMAIN EMAIL AS VARCHAR CHECK LOCATE('@', VALUE) > 0;
1564: * CREATE DOMAIN EMAIL AS VARCHAR CHECK LOCATE('@', VALUE) > 0;
1565: * </pre>
1566: */
1567: public static final int USER_DATA_TYPE_ALREADY_EXISTS_1 = 90119;
1568:
1569: /**
1570: * The error with code <code>90120</code> is thrown when
1571: * trying to drop a domain that doesn't exists.
1572: * Example:
1573: * <pre>
1574: * DROP DOMAIN UNKNOWN;
1575: * </pre>
1576: */
1577: public static final int USER_DATA_TYPE_NOT_FOUND_1 = 90120;
1578:
1579: /**
1580: * The error with code <code>90121</code> is thrown when
1581: * a database operation is started while the virtual machine exits
1582: * (for example in a shutdown hook), or when the session is closed.
1583: */
1584: public static final int DATABASE_CALLED_AT_SHUTDOWN = 90121;
1585:
1586: /**
1587: * The error with code <code>90122</code> is thrown when
1588: * trying to altering, adding or dropping columns of a table that has views.
1589: * Example:
1590: * <pre>
1591: * CREATE TABLE TEST(ID INT);
1592: * CREATE VIEW TEST_VIEW AS SELECT * FROM TEST;
1593: * ALTER TABLE TEST ADD COLUMN NAME VARCHAR;
1594: * </pre>
1595: */
1596: public static final int OPERATION_NOT_SUPPORTED_WITH_VIEWS_2 = 90122;
1597:
1598: /**
1599: * The error with code <code>90123</code> is thrown when
1600: * trying mix regular parameters and indexed parameters in the same statement.
1601: * Example:
1602: * <pre>
1603: * SELECT ?, ?1 FROM DUAL;
1604: * </pre>
1605: */
1606: public static final int CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS = 90123;
1607:
1608: /**
1609: * The error with code <code>90124</code> is thrown when
1610: * trying to access a file that doesn't exist. This can occur when trying to
1611: * read a lob if the lob file has been deleted by another application.
1612: */
1613: public static final int FILE_NOT_FOUND_1 = 90124;
1614:
1615: /**
1616: * The error with code <code>90125</code> is thrown when
1617: * PreparedStatement.setBigDecimal is called
1618: * with object that extends the class BigDecimal, and the system property
1619: * h2.allowBigDecimalExtensions is not set. Using extensions of BigDecimal is
1620: * dangerous because the database relies on the behavior of BigDecimal.
1621: * <pre>
1622: * BigDecimal bd = new MyDecimal("$10.3");
1623: * prep.setBigDecimal(1, bd);
1624: * Invalid class, expected java.math.BigDecimal but got MyDecimal
1625: * </pre>
1626: * Correct:
1627: * <pre>
1628: * BigDecimal bd = new BigDecimal("10.3");
1629: * prep.setBigDecimal(1, bd);
1630: * </pre>
1631: */
1632: public static final int INVALID_CLASS_2 = 90125;
1633:
1634: /**
1635: * The error with code <code>90126</code> is thrown when
1636: * trying to call the BACKUP statement for an in-memory database.
1637: * Example:
1638: * <pre>
1639: * jdbc:h2:mem:
1640: * BACKUP TO 'test.zip';
1641: * </pre>
1642: */
1643: public static final int DATABASE_IS_NOT_PERSISTENT = 90126;
1644:
1645: /**
1646: * The error with code <code>90127</code> is thrown when
1647: * trying to update or delete a row in a result set if the result set is
1648: * not updatable.
1649: */
1650: public static final int RESULT_SET_NOT_UPDATABLE = 90127;
1651:
1652: /**
1653: * The error with code <code>90128</code> is thrown when
1654: * trying to call a method of the ResultSet that is only supported
1655: * for scrollable result sets, and the result set is not scrollable.
1656: * Example:
1657: * <pre>
1658: * rs.first();
1659: * </pre>
1660: */
1661: public static final int RESULT_SET_NOT_SCROLLABLE = 90128;
1662:
1663: /**
1664: * The error with code <code>90129</code> is thrown when
1665: * trying to commit a transaction that doesn't exist.
1666: * Example:
1667: * <pre>
1668: * PREPARE COMMIT ABC;
1669: * COMMIT TRANSACTION TEST;
1670: * </pre>
1671: */
1672: public static final int TRANSACTION_NOT_FOUND_1 = 90129;
1673:
1674: /**
1675: * The error with code <code>90130</code> is thrown when
1676: * an execute method of PreparedStatement was called with a SQL statement.
1677: * This is not allowed according to the JDBC specification. Instead, use
1678: * an execute method of Statement. Example:
1679: * <pre>
1680: * PreparedStatement prep = conn.prepareStatement("SELECT * FROM TEST");
1681: * prep.execute("DELETE FROM TEST");
1682: * </pre>
1683: * Correct:
1684: * <pre>
1685: * Statement stat = conn.createStatement();
1686: * stat.execute("DELETE FROM TEST");
1687: * </pre>
1688: */
1689: public static final int METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT = 90130;
1690:
1691: /**
1692: * The error with code <code>90131</code> is thrown when
1693: * using multi version concurrency control, and trying to update the same
1694: * row from within two connections at the same time.
1695: * Example:
1696: * <pre>
1697: * jdbc:h2:~/test;MVCC=TRUE
1698: * Session 1:
1699: * CREATE TABLE TEST(ID INT);
1700: * INSERT INTO TEST VALUES(1);
1701: * SET AUTOCOMMIT FALSE;
1702: * UPDATE TEST SET ID = 2;
1703: * Session 2:
1704: * SET AUTOCOMMIT FALSE;
1705: * UPDATE TEST SET ID = 3;
1706: * </pre>
1707: */
1708: public static final int CONCURRENT_UPDATE_1 = 90131;
1709:
1710: /**
1711: * The error with code <code>90132</code> is thrown when
1712: * trying to drop a user defined aggregate function that doesn't exist.
1713: * Example:
1714: * <pre>
1715: * DROP AGGREGATE UNKNOWN;
1716: * </pre>
1717: */
1718: public static final int AGGREGATE_NOT_FOUND_1 = 90132;
1719:
1720: /**
1721: * The error with code <code>90133</code> is thrown when
1722: * trying to change a specific database property while the database is already
1723: * open. The MVCC property needs to be set in the first connection
1724: * (in the connection opening the database) and can not be changed later on.
1725: */
1726: public static final int CANNOT_CHANGE_SETTING_WHEN_OPEN_1 = 90133;
1727:
1728: /**
1729: * The error with code <code>90134</code> is thrown when
1730: * trying to load a Java class that is not part of the allowed classes.
1731: * By default, all classes are allowed, but this can be changed using the system
1732: * property h2.allowedClasses.
1733: */
1734: public static final int ACCESS_DENIED_TO_CLASS_1 = 90134;
1735:
1736: /**
1737: * The error with code <code>90135</code> is thrown when
1738: * trying to open a connection to a database that is currently open
1739: * in exclusive mode. The exclusive mode is set using:
1740: * <pre>
1741: * SET EXCLUSIVE TRUE;
1742: * </pre>
1743: */
1744: public static final int DATABASE_IS_IN_EXCLUSIVE_MODE = 90135;
1745:
1746: /**
1747: * The error with code <code>90136</code> is thrown when
1748: * executing a query that used an unsupported outer join condition.
1749: * Example:
1750: * <pre>
1751: * SELECT * FROM DUAL A LEFT JOIN DUAL B ON B.X=(SELECT MAX(X) FROM DUAL);
1752: * </pre>
1753: */
1754: public static final int UNSUPPORTED_OUTER_JOIN_CONDITION_1 = 90136;
1755:
1756: /**
1757: * The error with code <code>90137</code> is thrown when
1758: * trying to assign a value to something that is not a variable.
1759: * <pre>
1760: * SELECT AMOUNT, SET(@V, IFNULL(@V, 0)+AMOUNT) FROM TEST;
1761: * </pre>
1762: */
1763: public static final int CAN_ONLY_ASSIGN_TO_VARIABLE_1 = 90137;
1764:
1765: // next is 90108
1766:
1767: /**
1768: * INTERNAL
1769: */
1770: public static String getState(int errorCode) {
1771: // To convert SQLState to error code, replace
1772: // 21S: 210, 42S: 421, HY: 50, C: 1, T: 2
1773:
1774: switch (errorCode) {
1775: // 02: no data
1776: case NO_DATA_AVAILABLE:
1777: return "02000";
1778:
1779: // 07: dynamic SQL error
1780: case INVALID_PARAMETER_COUNT_2:
1781: return "07001";
1782:
1783: // 08: connection exception
1784: case ERROR_OPENING_DATABASE:
1785: return "08000";
1786: case WRONG_USER_OR_PASSWORD:
1787: return "08004";
1788:
1789: // 21: cardinality violation
1790: case COLUMN_COUNT_DOES_NOT_MATCH:
1791: return "21S02";
1792:
1793: // 42: syntax error or access rule violation
1794: case SYNTAX_ERROR_1:
1795: return "42000";
1796: case SYNTAX_ERROR_2:
1797: return "42001";
1798: case TABLE_OR_VIEW_ALREADY_EXISTS_1:
1799: return "42S01";
1800: case TABLE_OR_VIEW_NOT_FOUND_1:
1801: return "42S02";
1802: case INDEX_ALREADY_EXISTS_1:
1803: return "42S11";
1804: case INDEX_NOT_FOUND_1:
1805: return "42S12";
1806: case DUPLICATE_COLUMN_NAME_1:
1807: return "42S21";
1808: case COLUMN_NOT_FOUND_1:
1809: return "42S22";
1810:
1811: // 0A: feature not supported
1812:
1813: // HZ: remote database access
1814:
1815: // HY
1816: case GENERAL_ERROR_1:
1817: return "HY000";
1818: case UNKNOWN_DATA_TYPE_1:
1819: return "HY004";
1820:
1821: case FEATURE_NOT_SUPPORTED:
1822: return "HYC00";
1823: case LOCK_TIMEOUT_1:
1824: return "HYT00";
1825: default:
1826: return "" + errorCode;
1827: }
1828: }
1829:
1830: }
|