Documentation Home
MySQL 连接器/J 8.0 开发人员指南  / 第 6 章连接器/J 参考  /  6.16 将 MySQL 错误号映射到 JDBC SQLState 代码

6.16 将 MySQL 错误号映射到 JDBC SQLState 代码

下表提供了 MySQL 错误号到 JDBCSQLState值的映射。

表 6.24 MySQL 错误号到 SQLState 的映射

MySQL 错误号 MySQL 错误名称 SQL 标准 SQLState
1022 ER_DUP_KEY 23000
1037 ER_OUTOFMEMORY HY001
1038 ER_OUT_OF_SORTMEMORY HY001
1040 ER_CON_COUNT_ERROR 08004
1042 ER_BAD_HOST_ERROR 08S01
1043 ER_HANDSHAKE_ERROR 错误 08S01
1044 ER_DBACCESS_DENIED_ERROR 42000
1045 ER_ACCESS_DENIED_ERROR 28000
1046 ER_NO_DB_ERROR 3D000
1047 ER_UNKNOWN_COM_ERROR 08S01
1048 ER_BAD_NULL_ERROR 23000
1049 ER_BAD_DB_ERROR 42000
1050 ER_TABLE_EXISTS_ERROR 42S01
1051 ER_BAD_TABLE_ERROR 42S02
1052 ER_NON_UNIQ_ERROR 23000
1053 ER_SERVER_SHUTDOWN 08S01
1054 ER_BAD_FIELD_ERROR 42S22
1055 ER_WRONG_FIELD_WITH_GROUP 42000
1056 ER_WRONG_GROUP_FIELD 42000
1057 ER_WRONG_SUM_SELECT 42000
1058 ER_WRONG_VALUE_COUNT 21S01
1059 ER_TOO_LONG_IDENT 42000
1060 ER_DUP_FIELDNAME 42S21
1061 ER_DUP_KEYNAME 42000
1062 ER_DUP_ENTRY 23000
1063 ER_WRONG_FIELD_SPEC 42000
1064 ER_PARSE_ERROR 42000
1065 ER_EMPTY_QUERY 42000
1066 ER_NONUNIQ_TABLE 42000
1067 ER_INVALID_DEFAULT 42000
1068 ER_MULTIPLE_PRI_KEY 42000
1069 ER_TOO_MANY_KEYS 42000
1070 ER_TOO_MANY_KEY_PARTS 42000
1071 ER_TOO_LONG_KEY 42000
1072 ER_KEY_COLUMN_DOES_NOT_EXITS 42000
1073 ER_BLOB_USED_AS_KEY 42000
1074 ER_TOO_BIG_FIELDLENGTH 42000
1075 ER_WRONG_AUTO_KEY 42000
1080 ER_FORCING_CLOSE 08S01
1081 ER_IPSOCK_错误 08S01
1082 ER_NO_SUCH_INDEX 42S12
1083 ER_WRONG_FIELD_TERMINATORS 42000
1084 ER_BLOBS_AND_NO_TERMINATED 42000
1090 ER_CANT_REMOVE_ALL_FIELDS 42000
1091 ER_CANT_DROP_FIELD_OR_KEY 42000
1101 ER_BLOB_CANT_HAVE_DEFAULT 42000
1102 ER_WRONG_DB_NAME 42000
1103 ER_WRONG_TABLE_NAME 42000
1104 ER_TOO_BIG_SELECT 42000
1106 ER_UNKNOWN_PROCEDURE 42000
1107 ER_WRONG_PARAMCOUNT_TO_PROCEDURE 42000
1109 ER_UNKNOWN_TABLE 42S02
1110 ER_FIELD_SPECIFIED_TWICE 42000
1112 ER_UNSUPPORTED_EXTENSION 42000
1113 ER_TABLE_MUST_HAVE_COLUMNS 42000
1115 ER_UNKNOWN_CHARACTER_SET 42000
1118 ER_TOO_BIG_ROWSIZE 42000
1120 ER_WRONG_OUTER_JOIN 42000
1121 ER_NULL_COLUMN_IN_INDEX 42000
1131 ER_PASSWORD_ANONYMOUS_USER 42000
1132 ER_PASSWORD_NOT_ALLOWED 42000
1133 ER_PASSWORD_NO_MATCH 42000
1136 ER_WRONG_VALUE_COUNT_ON_ROW 21S01
1138 ER_INVALID_USE_OF_NULL 22004
1139 ER_REGEXP_ERROR 42000
1140 ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000
1141 ER_NONEXISTING_GRANT 42000
1142 ER_TABLEACCESS_DENIED_ERROR 42000
1143 ER_COLUMNACCESS_DENIED_ERROR 42000
1144 ER_ILLEGAL_GRANT_FOR_TABLE 42000
1145 ER_GRANT_WRONG_HOST_OR_USER 42000
1146 ER_NO_SUCH_TABLE 42S02
1147 ER_NONEXISTING_TABLE_GRANT 42000
1148 ER_NOT_ALLOWED_COMMAND 42000
1149 ER_SYNTAX_ERROR 42000
1152 ER_ABORTING_CONNECTION 08S01
1153 ER_NET_PACKET_TOO_LARGE 08S01
1154 ER_NET_READ_ERROR_FROM_PIPE 08S01
1155 ER_NET_FCNTL_ERROR 08S01
1156 ER_NET_PACKETS_OUT_OF_ORDER 08S01
1157 ER_NET_UNCOMPRESS_ERROR 08S01
1158 ER_NET_READ_ERROR 08S01
1159 ER_NET_READ_INTERRUPTED 08S01
1160 ER_NET_ERROR_ON_WRITE 08S01
1161 ER_NET_WRITE_INTERRUPTED 08S01
1162 ER_TOO_LONG_STRING 42000
1163 ER_TABLE_CANT_HANDLE_BLOB 42000
1164 ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 42000
1166 ER_WRONG_COLUMN_NAME 42000
1167 ER_WRONG_KEY_COLUMN 42000
1169 ER_DUP_UNIQUE 23000
1170 ER_BLOB_KEY_WITHOUT_LENGTH 42000
1171 ER_PRIMARY_CANT_HAVE_NULL 42000
1172 ER_TOO_MANY_ROWS 42000
1173 ER_REQUIRES_PRIMARY_KEY 42000
1176 ER_KEY_DOES_NOT_EXITS 42000
1177 ER_CHECK_NO_SUCH_TABLE 42000
1178 ER_CHECK_NOT_IMPLEMENTED 42000
1179 ER_CANT_DO_THIS_DURING_AN_TRANSACTION 25000
1184 ER_NEW_ABORTING_CONNECTION 08S01
1189 ER_SOURCE_NET_READ 08S01
1190 ER_SOURCE_NET_WRITE 08S01
1203 ER_TOO_MANY_USER_CONNECTIONS 42000
1205 ER_LOCK_WAIT_TIMEOUT 40001
1207 ER_READ_ONLY_TRANSACTION 交易 25000
1211 ER_NO_PERMISSION_TO_CREATE_USER 42000
1213 ER_LOCK_DEADLOCK 40001
1216 ER_NO_REFERENCED_ROW 23000
1217 ER_ROW_IS_REFERENCED 23000
1218 ER_CONNECT_TO_SOURCE 08S01
1222 ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 21000
1226 ER_USER_LIMIT_REACHED 42000
1227 ER_SPECIFIC_ACCESS_DENIED_ERROR 42000
1230 ER_NO_DEFAULT 42000
1231 ER_WRONG_VALUE_FOR_VAR 42000
1232 ER_WRONG_TYPE_FOR_VAR 42000
1234 ER_CANT_USE_OPTION_HERE 42000
1235 ER_NOT_SUPPORTED_YET 42000
1239 ER_WRONG_FK_DEF 42000
1241 ER_OPERAND_COLUMNS 21000
1242 ER_SUBQUERY_NO_1_ROW 21000
1247 ER_ILLEGAL_REFERENCE 42S22
1248 ER_DERIVED_MUST_HAVE_ALIAS 42000
1249 ER_SELECT_REDUCED 01000
1250 ER_TABLENAME_NOT_ALLOWED_HERE 42000
1251 ER_NOT_SUPPORTED_AUTH_MODE 08004
1252 ER_SPATIAL_CANT_HAVE_NULL 42000
1253 ER_COLLATION_CHARSET_MISMATCH 42000
1261 ER_WARN_TOO_FEW_RECORDS 01000
1262 ER_WARN_TOO_MANY_RECORDS 01000
1263 ER_WARN_NULL_TO_NOTNULL 22004
1264 ER_WARN_DATA_OUT_OF_RANGE 22003
1265 ER_WARN_DATA_TRUNCATED 01000
1280 ER_WRONG_NAME_FOR_INDEX 42000
1281 ER_WRONG_NAME_FOR_CATALOG 42000
1286 ER_UNKNOWN_STORAGE_ENGINE 42000
1292 ER_TRUNCATED_WRONG_VALUE 22007
1303 ER_SP_NO_RECURSIVE_CREATE 2F003
1304 ER_SP_ALREADY_EXISTS 42000
1305 ER_SP_DOES_NOT_EXIST 42000
1308 ER_SP_LILABEL_MISMATCH 42000
1309 ER_SP_LABEL_REDEFINE 42000
1310 ER_SP_LABEL_MISMATCH 42000
1311 ER_SP_UNINIT_VAR 01000
1312 ER_SP_BADSELECT 0A000
1313 ER_SP_BADRETURN 42000
1314 ER_SP_BADSTATEMENT 0A000
1315 ER_UPDATE_LOG_DEPRECATED_IGNORED 42000
1316 ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000
1317 ER_QUERY_INTERRUPTED 70100
1318 ER_SP_WRONG_NO_OF_ARGS 42000
1319 ER_SP_COND_MISMATCH 42000
1320 ER_SP_NORETURN 42000
1321 ER_SP_NORETURNEND 2F005
1322 ER_SP_BAD_CURSOR_QUERY 42000
1323 ER_SP_BAD_CURSOR_SELECT 42000
1324 ER_SP_CURSOR_MISMATCH 42000
1325 ER_SP_CURSOR_ALREADY_OPEN 24000
1326 ER_SP_CURSOR_NOT_OPEN 24000
1327 ER_SP_UNDECLARED_VAR 42000
1329 ER_SP_FETCH_NO_DATA 02000
1330 ER_SP_DUP_PARAM 42000
1331 ER_SP_DUP_VAR 42000
1332 ER_SP_DUP_COND 42000
1333 ER_SP_DUP_CURS 42000
1335 ER_SP_SUBSELECT_NYI 0A000
1336 ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 0A000
1337 ER_SP_VARCOND_AFTER_CURSHNDLR 42000
1338 ER_SP_CURSOR_AFTER_HANDLER 42000
1339 ER_SP_CASE_NOT_FOUND 20000
1365 ER_DIVISION_BY_ZERO 22012
1367 ER_ILLEGAL_VALUE_FOR_TYPE 22007
1370 ER_PROCACCESS_DENIED_ERROR 42000
1397 ER_XAER_NOTA XAE04
1398 ER_XAER_INVAL XAE05
1399 ER_XAER_RMFAIL XAE07
1400 ER_XAER_OUTSIDE XAE09
1401 ER_XA_RMERR XAE03
1402 ER_XA_RBROLLBACK XA100
1403 ER_NONEXISTING_PROC_GRANT 42000
1406 ER_DATA_TOO_LONG 22001
1407 ER_SP_BAD_SQLSTATE 42000
1410 ER_CANT_CREATE_USER_WITH_GRANT 42000
1413 ER_SP_DUP_HANDLER 42000
1414 ER_SP_NOT_VAR_ARG 42000
1415 ER_SP_NO_RETSET 0A000
1416 ER_CANT_CREATE_GEOMETRY_OBJECT 22003
1425 ER_TOO_BIG_SCALE 42000
1426 ER_TOO_BIG_PRECISION 42000
1427 ER_M_BIGGER_THAN_D 42000
1437 ER_TOO_LONG_BODY 42000
1439 ER_TOO_BIG_DISPLAYWIDTH 42000
1440 ER_XAER_DUPID XAE08
1441 ER_DATETIME_FUNCTION_OVERFLOW 22008
1451 ER_ROW_IS_REFERENCED_2 23000
1452 ER_NO_REFERENCED_ROW_2 23000
1453 ER_SP_BAD_VAR_SHADOW 42000
1458 ER_SP_WRONG_NAME 42000
1460 ER_SP_NO_AGGREGATE 42000
1461 ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
1463 ER_NON_GROUPING_FIELD_USED 42000
1557 ER_FOREIGN_DUPLICATE_KEY 23000
1568 ER_CANT_CHANGE_TX_ISOLATION 25001
1582 ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 42000
1583 ER_WRONG_PARAMETERS_TO_NATIVE_FCT 42000
1584 ER_WRONG_PARAMETERS_TO_STORED_FCT 42000
1586 ER_DUP_ENTRY_WITH_KEY_NAME 23000
1613 ER_XA_RBTIMEOUT XA106
1614 ER_XA_RBDEADLOCK XA102
1630 ER_FUNC_INEXISTENT_NAME_COLLISION 42000
1641 ER_DUP_SIGNAL_SET 42000
1642 ER_SIGNAL_WARN 01000
1643 ER_SIGNAL_NOT_FOUND 02000
1645 ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 0K000
1687 ER_SPATIAL_MUST_HAVE_GEOM_COL 42000
1690 ER_DATA_OUT_OF_RANGE 22003
1698 ER_ACCESS_DENIED_NO_PASSWORD_ERROR 28000
1701 ER_TRUNCATE_ILLEGAL_FK 42000
1758 ER_DA_INVALID_CONDITION_NUMBER 35000
1761 ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 23000
1762 ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 23000
1792 ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 25006
1845年 ER_ALTER_OPERATION_NOT_SUPPORTED 0A000
1846年 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 0A000
1859年 ER_DUP_UNKNOWN_IN_INDEX 23000
1873年 ER_ACCESS_DENIED_CHANGE_USER_ERROR 28000
1887年 ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 0Z002
1903年 ER_INVALID_ARGUMENT_FOR_LOGARITHM 2201E