-------------------------------------------------- ----------------------------- mysql error code table, according to mySQL's header file mysql / include / mysqld_error.h finishing to make. In the wrong place, please correct it.
1005: Creating a table failed 1006: Create a database failed 1007: Database already exists, create database failed 1008: Database does not exist, delete database failed 1009: Cannot delete database files caused to delete database failed 1010: Cannot delete data directory results in deletion of database failure 1011: Deleting a database file failure 1012: You cannot read the record 1020 in the system table: Record has been modified by other users 1021: Hard disk remaining space, please increase the hard disk free space 1022: Keyword duplicate, change record failed 1023: Errors occur when it is closed 1024: Read file error 1025: An error occurred while changing the name 1026: Write file error 1032: Record does not exist 1036: Data table is read-only, do not modify it 1037: The system is insufficient, please restart the database or restart the server 1038: Unsode for sorting, increase the sort buffer 1040: The maximum number of connections that have arrived in the database, please increase the number of connections available to the database 1041: System memory is not enough 1042: Invalid host name 1043: Invalid connection 1044: The current user is not Access to the database 1045: Cannot connect the database, username or password error 1048: Field can't be empty 1049: Database does not exist 1051: Data table has existed 1054: The data table does not exist 1065: Invalid SQL statement, SQL statement is empty 1081: Cannot establish a socket connection 1114: Data table is full, can not accommodate any record 1116: Open data table Too many 1129: Database 1130: Connect the database failure, no connection database 1133 : Database users do not exist 1141: Current users No access to database 1142: Current users No need to access data table 1143: The current user does not have access to fields 1146 in the data table: Data table does not exist 1147: Upon access to data sheets Permissions 1149: SQL statement syntax error 1158: Network error, read error, please check network connection status 1159: Network error, read timeout, please check network connection status 1160: Network error, write error, please check network connection status 1161: Network error, write timeout, please check the network connection status 1062: field value repetition, invigorate 1169: field value repeat, update record failed 1177: Open data table failed 1180: Submit business failed 1181: Rolling business failed 1203: Current User And the database established by the database has arrived at the maximum connection of the database, increase the number of available database connections or restart the database 1205: Plock timeout 1211: Current user does not create a user's permission 1216: Foreign key constraint check failed, updated child table record Failure 1217: Foreign key constraints fail, delete or modify the primary table record failed 1226: The current user uses resources that exceed the resources allowed, please Enable database or restart server 1227: Insufficient permissions, you have no right to do this 1235: MySQL version is too low, do not have this function with a Java class, you can translate MySQL's error code into a corresponding error message.
Import java.util. *;
Public class myerrorcontext {public static class myerror {int errno; string szerrordesc; public myerror (int errno, string errno; this.szerrordesc = errotesc;}
Public int getError () {Return errno;}
Public String getRrordesc () {return szerrordesc;}}
public static final int DB_ER_CANT_CREATE_TABLE = 1005; // table creation failed public static final int DB_ER_CANT_CREATE_DB = 1006; // Create database failed public static final int DB_ER_DB_CREATE_EXISTS = 1007; // database already exists, create a database failed public static final int DB_ER_DB_DROP_EXISTS = 1008 ; // Database does not exist, delete database failed public static final int db_er_db_drop_delete = 1009; // Can't delete database files caused to delete database failed public static final int DB_ER_DB_DROP_RMDIR = 1010; // Cannot delete data directory caused to delete database failed public static final int INT DB_ER_CANT_DELETE_FILE = 1011; // delete the database file failed public static final int DB_ER_CANT_FIND_SYSTEM_REC = 1012; // can not read the record system table public static final int DB_ER_CHECKREAD = 1020; // record has been modified public static final int DB_ER_DISK_FULL other users = 1021; // Hard disk remaining space, please increase the hard disk free space public static final int db_er_dup_key = 1022; // Keyword repeat, change record failed public static final int db_er_error_on_close = 1023; // Closed error PUBLIC Static Final Int DB_ER_ERROR_ON_READ = 1024; // Read File Error PUBLIC Static Final Int DB_ER_ERROR_ON_RENAME = 1025; // When changing the name Mrror PUBLIC Static Final INT DB_ER_ERROR_ON_WRITE = 1026; // Write File Error PUBLIC Static Final INT DB_ER_KEY_NOT_FOUND = 1032; // Record does not exist public static final int db_er_open_as_readonly = 1036; // Data table is read-only, do not modify it PUBLIC Static Final Int db_er_OutofMemory = 1037; // System memory insufficient, restart the database or restart the server public static final int db_er_out_of_sortmemory = 1038; // Unsupported in order, increase the sort buffer PUBLIC Static Final INT DB_ER_CON_COUNT_ERROR = 1040; / / The maximum number of connections that have arrived in the database, increase the number of databases available connections public static final int db_er_out_of_resources = 1041; // System memory is not enough public static final int DB_ER_BAD_HOST_ERROR = 1042;
// invalid host name public static final int DB_ER_HANDSHAKE_ERROR = 1043; // invalid connection public static final int DB_ER_DBACCESS_DENIED_ERROR = 1044; // current user does not have access rights to the database public static final int DB_ER_ACCESS_DENIED_ERROR = 1045; // can not connect to the database, the user name or password is incorrect public static final int DB_ER_BAD_NULL_ERROR = 1048; // field can not be null public static final int DB_ER_BAD_DB_ERROR = 1049; // database does not exist public static final int DB_ER_TABLE_EXISTS_ERROR = 1050; // data sheet has been public static final int DB_ER_BAD_TABLE_ERROR exist = 1051; // Data table does not exist public static final INT DB_ER_BAD_FIELD_ERROR = 1054; // field does not exist public static final int db_er_empty_query = 1065; // invalid SQL statement, SQL statement is empty public static final INT DB_ER_IPSOCK_ERROR = 1081; / / Socket connection can not be established public static final int DB_ER_RECORD_FILE_FULL = 1114; // data table is full, the recording can not accommodate any public static final int DB_ER_TOO_MANY_TABLES = 1116; // open data tables much public static final int DB_ER_HOST_IS_BLOCKED = 1129; // The database appears anomaly, please restart the database public static final int db_er_host_not_privileged = 1130; // connect to the database fails, no connection permission to the database public static final int DB_ER_PASSWORD_NO_MATCH = 1133; // database user public static final int DB_ER_NONEXISTING_GRANT does not exist = 1141; // current user does not have access to the database public static final int DB_ER_TABLEACCESS_DENIED_ERROR = 1142 ; // the current user does not have access tables public static final int DB_ER_COLUMNACCESS_DENIED_ERROR = 1143; // public static final field current user does not have access to data in the table int DB_ER_NO_SUCH_TABLE = 1146; // no data table public static final int DB_ER_NONEXISTING_TABLE_GRANT = 1147; // Undefined user access to the data table PUBLIC Static Final Int db_er_syntax_error = 1149; // SQL Statement Syntax Error PUBLIC STATIC FINAL INT DB_ER_NET_READ_ERROR = 1158;
// Network error, read error, please check network connection status public static final INT DB_ER_NET_READ_INTERRUPTED = 1159; // Network error, read timeout, please check network connection status public static final int db_er_net_error_on_write = 1160; // Network error, write Error, please check the network connection status public int db_er_net_write_interrupted = 1161; // Network error = 1169; // duplicate field values, update records failed public static final int DB_ER_CHECK_NO_SUCH_TABLE = 1177; // open the data table failed public static final int DB_ER_ERROR_DURING_COMMIT = 1180; // commit the transaction failed public static final int DB_ER_ERROR_DURING_ROLLBACK = 1181; // return Rolling transaction failed public static final int db_er_too_many_user_connections = 1203; // Current User and Database Established Connection The maximum number of connections that have arrived in the database, increase the number of database connections available or restart database public static final INT DB_ER_LOCK_WAIT_TIMEOUT = 1205; // plus Lock timeout PUBLIC Static Final Int db_er_no_permission_to_create_user = 1211; // Current user does not create a user's privilege public static final int db_er_no_referenced_row = 1216; // Foreign key constraint check failed, updated child table record failed public Static Final Int DB_ER_ROW_IS_REFERENCED = 1217; // Foreign key constraint check failed, delete or modify the primary table record failed public static final int db_er_user_limit_reat_reached = 1226; // The current user uses resources that have exceeded the resources allowed, please restart the database or restart the server. Public Static Final INT DB_ER_SPECIFIC_ACCESS_DENIED_ERROR = 1227; // If you don't have the right to do this public static final int db_er_not_supported_yet = 1235; // mysql version is too low, does not have this function
private static final MyError [] errormap = {new MyError (DB_ER_CANT_CREATE_TABLE, "table creation failed"), new MyError (DB_ER_CANT_CREATE_DB, "Failed to create database"), new MyError (DB_ER_DB_CREATE_EXISTS, "database already exists, create a database failure"), new MyError (DB_ER_DB_DROP_EXISTS, "Database does not exist, delete database failed"), new myerror (DB_ER_DB_DROP_DELETE, "You cannot delete database files"), new myerror (db_er_db_drop_rmdir, "You cannot delete data catalogs"), New MyError (DB_ER_CANT_DELETE_FILE, "Delete Database File Failed"), New MyError (DB_ER_CANT_FIND_SYSTEM_REC, "Recording" in the system table "), new myerror (DB_ER_CHECKREAD," Record has been modified by other users "), new myerror (db_er_disk_full," Insufficient hard disk remaining, please increase the hard disk free space "), new myerror (db_er_dup_key," keyword repeat, change record failed "), new myerror (db_er_error_on_close," error occurred while turning off "), new myerror (db_er_error_on_read," reading File Error "), new myerror (DB_ER_ERROR_ON_RENAME," Change Name When Errors "), New MyError (DB_ER_EROR_ON_WRITE," Write File Error "), New MyError (DB_ER_KEY_NOT_FOUND," Record does not exist "), new myerror (db_er_open_as_readonly "Data table is read-only, can not modify it") Increase Sort Buffer "), New MyError (DB_ER_CON_COUNT_ERROR," "The maximum number of connections to the database is reached, please increase the number of connections available to the database"), new myerror (db_er_out_of_resources, "system memory is insufficient"), new myerror (db_er_bad_host_error, " Invalid host name "), new myerror (db_er_handshake_error," invalid connection "), new myerror (db_er_dbaccess_denied_error," The current user does not access the database "
NEW MYERROR (DB_ER_ACCESS_DENIED_ERROR, "Cannot Connect Database, User Name or Password Error"), New MyError (DB_ER_BAD_NULL_ERROR, "Field Can't empty"), new myerror (db_er_bad_db_error, "database does not exist"), new myerror (db_er_table_exists_error, "Data table already exists"), new myerror (DB_ER_BAD_TABLE_ERROR, "Data Table does not exist"), new myerror (db_er_bad_field_error, "field does not exist"), new myerror (db_er_empty_query, "invalid SQL statement, SQL statement is empty") New myerror (db_er_ipsock_error, "cannot establish a socket connection"), new myerror (db_er_record_file_full, "Data Table is full, can not accommodate any record"), new myerror (db_er_too_many_tables, "Too many data sheets"), New MyError, "NEW MYERROR DB_ER_HOST_IS_BLOCKED, "database appears abnormal, please restart the database"), new MyError (DB_ER_HOST_NOT_PRIVILEGED, "establishing a database connection, permissions to the database is not connected"), new MyError (DB_ER_PASSWORD_NO_MATCH, "database user does not exist"), new MyError (DB_ER_NONEXISTING_GRANT, " Current User No access to Database "), New MyError (DB_ER_TABLEACCESS_DENIED_ERROR," Current User No Access Data Sheet "), New MyError (DB_ER_COLUMNACCESS_DENIED_ERROR," The current user does not have access to fields in the data table "), new myerror (db_er_no_such_ Table, "Data Table does not exist"), new myerror (DB_ER_NONEXISTING_TABLE_GRANT, "Upset User's Data Table Access Permissions"), New MyError (DB_ER_SYNTAX_ERROR, "SQL Statement Syntax Error"), New MyError (DB_ER_NET_READ_ERROR, "network error, Read error, please check network connection status "), new myerror (db_er_net_read_interrupted," network error, reading timeout, please check network connection status "), new myerror (db_er_net_error_on_write," network error, writing error, please check the network connection status "), New myerror (db_er_net_write_interrupted," network error, writing timeout, please check the network connection status "
NEW MYERROR (DB_ER_DUP_ENTRY, "Field Value Repeat, Branch Failed"), New MyError (DB_ER_DUP_UNIQUE, Field Value Repeat, Update Record Failure "), New MyError (DB_ER_CHECK_NO_SUCH_TABLE," Open Data Failed "), New MyError DB_ER_ERROR_DURING_COMMIT, "Submit Transaction Failed"), New MyError (DB_ER_ERROR_DURING_ROLLBACK, "Rolling Transaction Failed"), New MyError (DB_ER_TOO_MANY_USER_USER_CONNECTIONS, "Current User and Database Established Connection The maximum number of connections to the database, increase the available database connection Number or restart database "), new myerror (DB_ER_LOCK_WAIT_TIMEOUT," Plock Timeout "), New MyError (DB_ER_NO_PERMISSION_TO_CREATE_USER," Current User does not create permissions "), new myerror (db_er_no_referenced_row," foreign key constraint check failed, updated child table Record failed "), new myerror (DB_ER_ROW_IS_REFERENCED," Foreign key constraint check failed, delete or modify the primary table record failed "), new myerror (db_er_user_limit_reached," The current user uses resources exceeded the resources allowed, please restart the database or restart Server "), new myerror (db_er_specific_access_denied_error," If you don't have the right to do this "), new myerror (db_er_not_supported_yet," mysql version is too low, no this feature "),}; public static string geterrorinfo (int errno) {For (int i = 0; i Return ""; Public static void main (string [] args) {for (int i = 0; i