Previous Page TOC Index Next Page



APPENDIX A ERROR CODES


SQLError returns SQLSTATE values as defined by the X/Open and SQL Access Group SQL CAE specification (1992). SQLSTATE values are strings that contain five characters. The following table lists SQLSTATE values that a driver can return for SQLError.

The character string value returned for an SQLSTATE consists of a two character class value followed by a three character subclass value. A class value of "01" indicates a warning and is accompanied by a return code of SQL_SUCCESS_WITH_INFO. Class values other than "01", except for the class "IM", indicate an error and are accompanied by a return code of SQL_ERROR. The class "IM" is specific to warnings and errors that derive from the implementation of ODBC itself. The subclass value "000" in any class is for implementation defined conditions within the given class. The assignment of class and subclass values is defined by ANSI SQL-92.


Note Although successful execution of a function is normally indicated by a return value of SQL_SUCCESS, the SQLSTATE 00000 also indicates success.

SQLSTATE

Error

Can be returned from

01000

General warning

All ODBC functions except:

SQLAllocEnv
SQLError

01002

Disconnect error

SQLDisconnect

01004

Data truncated

SQLBrowseConnect
SQLColAttributes
SQLDataSources
SQLDescribeCol
SQLDriverConnect
SQLDrivers
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLGetCursorName
SQLGetData
SQLGetInfo
SQLNativeSql
SQLPutData
SQLSetPos

01006

Privilege not revoked

SQLExecDirect
SQLExecute

01S00

Invalid connection string attribute

SQLBrowseConnect
SQLDriverConnect

01S01

Error in row

SQLExtendedFetch
SQLSetPos

01S02

Option value changed

SQLSetConnectOption
SQLSetStmtOption

01S03

No rows updated or deleted

SQLExecDirect
SQLExecute
SQLSetPos

01S04

More than one row updated or deleted

SQLExecDirect
SQLExecute
SQLSetPos

07001

Wrong number of parameters

SQLExecDirect
SQLExecute

07006

Restricted data type attribute violation

SQLBindParameter
SQLExtendedFetch
SQLFetch
SQLGetData

08001

Unable to connect to data source

SQLBrowseConnect
SQLConnect
SQLDriverConnect

08002

Connection in use

SQLBrowseConnect
SQLConnect
SQLDriverConnect
SQLSetConnectOption

08003

Connection not open

SQLAllocStmt
SQLDisconnect
SQLGetConnectOption
SQLGetInfo
SQLNativeSql
SQLSetConnectOption
SQLTransact

08004

Data source rejected establishment of connection

SQLBrowseConnect
SQLConnect
SQLDriverConnect

08007

Connection failure during transaction

SQLTransact

08S01

Communication link failure

SQLBrowseConnect
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLFreeConnect
SQLGetData
SQLGetTypeInfo
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetConnectOption
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

21S01

Insert value list does not match column list

SQLExecDirect
SQLPrepare

21S02

Degree of derived table does not match column list

SQLExecDirect
SQLPrepare
SQLSetPos

22001

String data right truncation

SQLPutData

22002

Indicator variable required but not supplied

SQLFetch
SQLGetData

22003

Numeric value out of range

SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLGetData
SQLGetInfo
SQLPutData
SQLSetPos

22005

Error in assignment

SQLExecDirect
SQLExecute
SQLGetData
SQLPrepare
SQLPutData
SQLSetPos

22008

Datetime field overflow

SQLExecDirect
SQLExecute
SQLGetData
SQLPutData
SQLSetPos

22012

Division by zero

SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch

22026

String data, length mismatch

SQLParamData

23000

Integrity constraint violation

SQLExecDirect
SQLExecute
SQLSetPos

24000

Invalid cursor state

SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLDescribeCol
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetData
SQLGetStmtOption
SQLGetTypeInfo
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetCursorName
SQLSetPos
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

25000

Invalid transaction state

SQLDisconnect

28000

Invalid authorization specification

SQLBrowseConnect
SQLConnect
SQLDriverConnect

34000

Invalid cursor name

SQLExecDirect
SQLPrepare
SQLSetCursorName

37000

Syntax error or access violation

SQLExecDirect
SQLNativeSql
SQLPrepare

3C000

Duplicate cursor name

SQLSetCursorName

40001

Serialization failure

SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch

42000

Syntax error or access violation

SQLExecDirect
SQLExecute
SQLPrepare
SQLSetPos

70100

Operation aborted

SQLCancel

IM001

Driver does not support this function

All ODBC functions except:

SQLAllocConnect
SQLAllocEnv
SQLDataSources
SQLDrivers
SQLError
SQLFreeConnect
SQLFreeEnv
SQLGetFunctions

IM002

Data source name not found and no default driver specified

SQLBrowseConnect
SQLConnect
SQLDriverConnect

IM003

Specified driver could not be loaded

SQLBrowseConnect
SQLConnect
SQLDriverConnect

IM004

Driver’s SQLAllocEnv failed

SQLBrowseConnect
SQLConnect
SQLDriverConnect

IM005

Driver’s SQLAllocConnect failed

SQLBrowseConnect
SQLConnect
SQLDriverConnect

IM006

Driver’s SQLSetConnect-Option failed

SQLBrowseConnect
SQLConnect
SQLDriverConnect

IM007

No data source or driver specified; dialog prohibited

SQLDriverConnect

IM008

Dialog failed

SQLDriverConnect

IM009

Unable to load translation DLL

SQLBrowseConnect
SQLConnect
SQLDriverConnect
SQLSetConnectOption

IM010

Data source name too long

SQLBrowseConnect
SQLDriverConnect

IM011

Driver name too long

SQLBrowseConnect
SQLDriverConnect

IM012

DRIVER keyword syntax error

SQLBrowseConnect
SQLDriverConnect

IM013

Trace file error

All ODBC functions.

S0001

Base table or view already exists

SQLExecDirect
SQLPrepare

S0002

Base table not found

SQLExecDirect
SQLPrepare

S0011

Index already exists

SQLExecDirect
SQLPrepare

S0012

Index not found

SQLExecDirect
SQLPrepare

S0021

Column already exists

SQLExecDirect
SQLPrepare

S0022

Column not found

SQLExecDirect
SQLPrepare

S0023

No default for column

SQLSetPos

S1000

General error

All ODBC functions except:

SQLAllocEnv
SQLError

S1001

Memory allocation failure

All ODBC functions except:

SQLAllocEnv
SQLError
SQLFreeConnect
SQLFreeEnv

S1002

Invalid column number

SQLBindCol
SQLColAttributes
SQLDescribeCol
SQLExtendedFetch
SQLFetch
SQLGetData

S1003

Program type out of range

SQLBindCol
SQLBindParameter
SQLGetData

S1004

SQL data type out of range

SQLBindParameter
SQLGetTypeInfo

S1008

Operation canceled

All ODBC functions that can be processed asynchronously:

SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLDescribeCol
SQLDescribeParam
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetData
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

S1009

Invalid argument value

SQLAllocConnect
SQLAllocStmt
SQLBindCol
SQLBindParameter
SQLExecDirect
SQLForeignKeys
SQLGetData
SQLGetInfo
SQLNativeSql
SQLPrepare
SQLPutData
SQLSetConnectOption
SQLSetCursorName
SQLSetPos
SQLSetStmtOption

S1010

Function sequence error

SQLBindCol
SQLBindParameter
SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLDescribeCol
SQLDescribeParam
SQLDisconnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLFreeConnect
SQLFreeEnv
SQLFreeStmt
SQLGetConnectOption
SQLGetCursorName
SQLGetData
SQLGetFunctions
SQLGetStmtOption
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLParamOptions
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLRowCount
SQLSetConnectOption
SQLSetCursorName
SQLSetPos
SQLSetScrollOptions
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
SQLTransact

S1011

Operation invalid at this time

SQLGetStmtOption
SQLSetConnectOption
SQLSetStmtOption

S1012

Invalid transaction operation code specified

SQLTransact

S1015

No cursor name available

SQLGetCursorName

S1090

Invalid string or buffer length

SQLBindCol
SQLBindParameter
SQLBrowseConnect
SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDataSources
SQLDescribeCol
SQLDriverConnect
SQLDrivers
SQLExecDirect
SQLExecute
SQLForeignKeys
SQLGetCursorName
SQLGetData
SQLGetInfo
SQLNativeSql
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetCursorName
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

S1091

Descriptor type out of range

SQLColAttributes

S1092

Option type out of range

SQLFreeStmt
SQLGetConnectOption
SQLGetStmtOption
SQLSetConnectOption
SQLSetStmtOption

S1093

Invalid parameter number

SQLBindParameter
SQLDescribeParam

S1094

Invalid scale value

SQLBindParameter

S1095

Function type out of range

SQLGetFunctions

S1096

Information type out of range

SQLGetInfo

S1097

Column type out of range

SQLSpecialColumns

S1098

Scope type out of range

SQLSpecialColumns

S1099

Nullable type out of range

SQLSpecialColumns

S1100

Uniqueness option type out of range

SQLStatistics

S1101

Accuracy option type out of range

SQLStatistics

S1103

Direction option out of range

SQLDataSources
SQLDrivers

S1104

Invalid precision value

SQLBindParameter

S1105

Invalid parameter type

SQLBindParameter

S1106

Fetch type out of range

SQLExtendedFetch

S1107

Row value out of range

SQLExtendedFetch
SQLParamOptions
SQLSetPos
SQLSetScrollOptions

S1108

Concurrency option out of range

SQLSetScrollOptions

S1109

Invalid cursor position

SQLExecute
SQLExecDirect
SQLGetData
SQLGetStmtOption
SQLSetPos

S1110

Invalid driver completion

SQLDriverConnect

S1111

Invalid bookmark value

SQLExtendedFetch

S1C00

Driver not capable

SQLBindCol
SQLBindParameter
SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetConnectOption
SQLGetData
SQLGetInfo
SQLGetStmtOption
SQLGetTypeInfo
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetConnectOption
SQLSetPos
SQLSetScrollOptions
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
SQLTransact

S1T00

Timeout expired

SQLBrowseConnect
SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDescribeCol
SQLDescribeParam
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetData
SQLGetInfo
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

Previous Page TOC Index Next Page

Copyright © 1992-1997 Solid Information Technology Ltd All rights reserved.