TwinCAT Database Server error codes overview

Code (hex)

Code (Dec)

Description

0x0001 + ADS error code

65537 - 131071

ADS error code from declared ADS device

0x00020001

131073

Microsoft SQL Compact database (error code)

0x00040001

262145

Microsoft SQL database (error code)

0x00080001

524289

Microsoft Access database (error code)

0x00100001

1048577

MySQL database (error code)

0x00200001

2097153

Oracle database (error code)

0x00400001

4194305

DB2 database (error code)

0x00800001

8388609

PostgreSQL database (error code)

0x01000001

16777217

Interbase/Firebird database (error code)

0x02000001

33554433

TwinCAT Database Server error code

0x04000001

67108865

XML database (error code)

0x08000001

134217729

ASCII database (error code)

If one of the error codes mentioned above is issued at the "nErrID" output of a function block, an error has occurred during execution of an SQL statement. The SQL error code is then issued at the "sSQLState" output of the function block. The "sSQLState" output has the data type ST_DBSQLError. For each database type individual error codes are output.

A list of SQLStates can be found under: http://msdn.microsoft.com/en-us/library/ms714687(VS.85).aspx (SQLStates)

Database type

Error code reference

Microsoft SQL Compact database

http://technet.microsoft.com/en-us/library/ms171788.aspx / OleDB_Errorcodes.htm

Microsoft SQL database

OleDB_Errorcodes.htm

Microsoft Access database

OleDB_Errorcodes.htm

MySQL database

https://dev.mysql.com/doc/mysql-errors/8.0/en/client-error-reference.html

Oracle database

https://docs.oracle.com/cd/E11882_01/server.112/e17766/toc.htm

DB2 database

https://www.ibm.com/docs/en/db2-for-zos/12?topic=diagnostics-sqlstates-odbc-error-reporting

PostgreSQL database

http://www.postgresql.org/docs/current/static/errcodes-appendix.html

Interbase/Firebird database

http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-2.1-ErrorCodes.pdf

XML database

TcDBServer_XML_Errorcodes.htm

ASCII database

TcDBServer_ASCII_Errorcodes.htm