Appendix C. Common Database Errors

Following is a list of known SQL errors, and potential solutions to the problems that they represent.

Table C.1. Known Database Error Codes

DatabaseError CodeSQL StateMessageSolution
DB2-80323505 SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "%s" from having duplicate rows for those columns. Duplicate values have been inserted into a column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate values.
DB2-51142829 SQL0511N The FOR UPDATE clause is not allowed because the table specified by the cursor cannot be modified. A datastore transaction read was attempted on a table that is marked as read-only. Either read the data outside of a transaction, or use optimistic transactions.
DB2-40142818 SQL0401N The data types of the operands for the operation ">=" are not compatible. A mathematical comparison query was attempted on a field whose mapping was to a non-numeric field, such as VARCHAR. DB2 disallows such queries.
DB2-30222003 SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. Possible attempt to store a string of a length greater than is allowed by the database's column definition. If creation is done via the mappingtool, ensure that the jdbc-size JDO metadata extension specifies a large enough size for the column.
DB2-20442S02 SQL0204N "%s" is an undefined name. The database schema does not match the mapping defined in the metadata for the persistent class. See the mapping documentation.
DB2-9999922003 Numeric value out of range. A numeric range error occured. Ensure that the capacity of the numeric column is sufficient to hold the specified value the persistent object is attempting to store.
DB2-99999HY003 CLI0122E Program type out of range. A numeric or String range error occured. Ensure that the capacity of the numeric or string column is sufficient to store the specified value the persistent object is attempting to store.
HSQL-823000 Integrity constraint violation in statement %s Attempted modification of a row that would cause a violation of referential integrity constraints. Make sure to enable SQL statement ordering.
HSQL-923000 Violation of unique index: 23000 Violation of unique index in statement %s Duplicate values have been inserted into a column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate values.
HSQL-40S1000 General error: S1000 General error java.lang.NumberFormatException: %d in statement %s A numeric range error occured. Ensure that the capacity of the numeric column is sufficient to store the specified value the persistent object is attempting to store. Note that some versions of HSQL have a bug that prevents Long.MIN_VALUE from being stored.
MySQL1062S1009 Invalid argument value: Duplicate entry '1' for key 1 Duplicate values have been inserted into a column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate values.
MySQL 1196S1000 General error: Warning: Some non-transactional changed tables couldn't be rolled back One or more tables that are being manipulated are not configured to be transactional. Tables in MySQL, by default, do not support transactions. Table type for schema creation can be configured with the TableType property of the DBDictionary configuration property.
MySQL1213S1000 General error: Deadlock found when trying to get lock; Try restarting transaction A deadlock occured during a datastore transaction. This can occur when transaction TRANS1 locks table TABLE1, transaction TRANS2 locks table TABLE2, TRANS1 lines up to get a lock on TABLE2, and then TRANS2 lines up to get a lock on TABLE1. Deadlock prevention is the responsibility of the application, or the application server in which it runs. For more details, see the MySQL deadlock documentation.
MySQL008S01 Communication link failure: java.io.IOException The TCP connection underlying the JDBC Connection has been closed, possibly due to a timeout. If using Kodo's default data source, connection testing can be configured via the ConnectionFactoryProperties property.
MySQL1030S1000 General error: Got error 139 from table handler This is a bug in MySQL server, and can occur when using tables of type InnoDB when long SQL statements are sent to the server. Upgrade to a more recent version of MySQL to resolve the problem.
MySQL1054S0022 Column not found: Unknown column 'Infinity' in 'field list' MySQL disallows storage of Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY values.
Oracle17069null Use explicit XA call Manual transaction operations were attempted on a data source that was configured to use an XA transaction. In order to utilize XA transactions, set the kodo.jdbc.DataSourceMode property to enlisted.
Oracle17433null invalid arguments in call The Oracle JDBC driver throws this exception when a null username or password were specified. A username and password was not specified in the kodo.propertied, nor was it specified in the database configuration mechanism, nor was it specified in the PersistenceManager.getPersistenceManager invocation.
Oracle90442000 ORA-00904: invalid column name The database schema does not match the mapping defined in the metadata for the persistent class. See the mapping documentation.
Oracle172242000 ORA-01722: invalid number A number that Oracle cannot store has been persisted. This can happen when a String field in the persistent class is mapped to an Oracle column of type NUMBER and the String value is not numeric.
Oracle100072000 ORA-01000: maximum open cursors exceeded

Oracle limits the number of statements that can be open at any given time, and the application has made requests that keep open more statements than Oracle can handle. This can be resolved in one of the following ways:

  1. Increase the number of cursors allowed in the database. This is typically done by increasing the open_cursors parameter in the initSIDNAME.ora file.

  2. Ensure that Kodo query results and extent iterators are being closed, since open results will maintain an open ResultSet on the server side until they are garbage collected.

  3. Decrease the value of the MaxStatementCache parameter in the ConnectionFactoryProperties configuration property.

Oracle93242000 ORA-00932: inconsistent datatypes: expected - got CLOB A normal String field was mapped to an Oracle CLOB type. Oracle requires special handling for CLOBs. Ensure that the metadata for the persistent field is specified as a CLOB by setting the jdbc-size metadata extension to -1.
Oracle123000 ORA-00001: unique constraint (%s) violated Duplicate values have been inserted into a column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate values.
Oracle0null Underflow Exception A numeric underflow occured. Ensure that the capacity of the numeric column is sufficient to store the specified value the persistent object is attempting to store. Note that Oracle NUMERIC fields have a limitation of 38 digits.
Oracle0null Overflow Exception A numeric underflow occured. Ensure that the capacity of the numeric column is sufficient to store the specified value the persistent object is attempting to store. Note that Oracle NUMERIC fields have a limitation of 38 digits.
Pointbase78003ZW003 The value "%s" cannot be converted to a number. This can happen when a string field in the persistent class is mapped to a numeric column, and the string value cannot be parsed into a number.
Pointbase2520322003 Data exception -- numeric value out of range. %d. A numeric range error occured. Ensure that the capacity of the numeric column is sufficient to store the specified value the persistent object is attempting to store.
PostgreSQL0null ERROR: Unable to identify an operator '>=' for types 'numeric' and 'double precision' You will have to retype this query using an explicit cast An integer field is mapped to a decimal column type. PostgreSQL disallows performing numeric comparisons between integers and decimals.
PostgreSQL0null ERROR: Cannot insert a duplicate key into unique index bug488pcx_pkey Duplicate values have been inserted into a column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate values.
PostgreSQL0null ERROR: Attribute 'infinity' not found PostgreSQL disallows storage of Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY values.
PostgreSQL0null You will have to retype this query using an explicit cast A String field is mapped to a numeric column type. PostgreSQL disallows performing String comparisons in queries against a numeric column.
SQLServer008007 Can't start a cloned connection while in manual transaction mode. Append ";SelectMethod=cursor" to the ConnectionURL. See the description of the problem on the Microsoft support site.
SQLServer sp_cursorclose: The cursor identifier value provided (abcdef0) is not valid. This can sometimes show up as a warning when Kodo is closing a prepared statement. It is due to a bug in the SQLServer driver, and can be ignored, since it should not affect anything.
SQLServer306HY000 The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. A query ordering was attempted on a field that is mapped to a CLOB or BLOB, which is disallowed by SQLServer.
SQLServer8114HY000 Error converting data type varchar to %s. This can happen when a string field in the persistent class is mapped to a numeric column, and the string value cannot be parsed into a number.
SQLServer24522018 Syntax error converting the varchar value '%s' to a column of data type int. This can happen when a string field in the persistent class is mapped to a numeric column, and the string value cannot be parsed into a number.
SQLServer262723000 Violation of PRIMARY KEY constraint 'PK__%s'. Cannot insert duplicate key in object '%s'. Duplicate values have been inserted into a primary key column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate primary keys when using application identity.
SQLServer169HY000 A column has been specified more than once in the order by list. Columns in the order by list must be unique. Ensure that there are no duplicates in the ordering of the query.
SQLServer0HY000 Object has been closed. The TCP connection underlying the JDBC connection may have been closed, possibly due to a timeout. If using Kodo's default data source, connection testing can be configured via the ConnectionFactoryProperties configuration property.
Sybase 311ZZZZZ The optimizer could not find a unique index which it could use to scan table '%s' for cursor 'jconnect_implicit_%d' A pessimistic lock was attempted on a table that does not have a primary key (or other unique index). By default, the Kodo mappingtool does not create primary keys for join tables. In order to use datastore locking for relations, an IDENTITY column should be added to any tables that do not already have them.
Sybase 2762 The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database. This may happen when running the schematool against a Sybase database that is not configured to allow schema-altering commands to be executed from within a transaction. This can be enabled by entering the command sp_dboption database_name,"ddl in tran", true from isql. See the Sybase documentation for allowing data definition commands in transactions .
Sybase0JZ0BE JZ0BE: BatchUpdateException: Error occurred while executing batch statement: Arithmetic overflow during implicit conversion of NUMERIC value '%d' to a NUMERIC field. A numeric overflow occured. Ensure that the capacity of the numeric column is sufficient to store the specified value the persistent object is attempting to store.
Sybase0JZ00B JZ00B: Numeric overflow. A numeric overflow occured. Ensure that the capacity of the numeric column is sufficient to store the specified value the persistent object is attempting to store.
Sybase25742000 Implicit conversion from datatype 'VARCHAR' to 'TINYINT' is not allowed. Use the CONVERT function to run this query. A string field is stored in a column of numeric type. Sybase disallows querying against these fields.
Sybase169ZZZZZ Expression '1' and '8' in the ORDER BY list are same. Expressions in the ORDER BY list must be unique. Ensure that there are no duplicates in the ordering of the query.
Sybase511ZZZZZ Attempt to update or insert row failed because resultant row of size 2009 bytes is larger than the maximum size (1961 bytes) allowed for this table. Possible attempt to store a string of a length greater than is allowed by the database's column definition. If creation is done via the mappingtool, ensure that the jdbc-size JDO metadata extension specifies a large enough size for the column.
Sybase 260123000 Attempt to insert duplicate key row in object '%s' with unique index '%s' Duplicate values have been inserted into a column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate values.