Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6654983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:27:27+00:00 2026-05-26T01:27:27+00:00

I know that the MySQL errors are split into client and server types. Has

  • 0

I know that the MySQL errors are split into client and server types. Has anyone discerned any further structure in the numbering?

I love applications that hide errors from the user and try to recover and continue execution, so am trying to switch from printing a string like “Doh! Connection failed.” to a custom class of database exceptions and a single handler to catch all database connection errors that aren’t caught within the function that threw them or get rethrown. I figure I can try to recover right there and re-throw if that fails. I thought I might try using a different catch block for different types of errors like connection failures, memory errors, prepared procedure errors, etc., When I tried to figure out a test for connection errors to start with, there seem to be several clusters that may relate, however I’m not sure if some of them are connection errors or not! For example: Error 2048: (CR_INVALID_CONN_HANDLE) Invalid connection handle.( When would this occur?!?)

Some of the errors listed at briandunning.com/error-codes/?source=MySQL have a SQLSTATE code. what are these?

I am hoping I can test for a range or ranges using the existing codes.
Has anyone else tried to do this? is there a PEAR package? How about a good book?

If they aren’t following a logical pattern would I be better off rolling my own custom codes? Is there a better approach I don’t see? This is my first time with exceptions, so I may be going about this all wrong. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:27:28+00:00Added an answer on May 26, 2026 at 1:27 am

    Some of the errors listed have a SQLSTATE code. what are these?

    From the MySQL manual:

    const char *mysql_sqlstate(MYSQL *mysql)
    Returns a null-terminated string containing the SQLSTATE error code for the most recently executed SQL statement. The error code consists of five characters. ‘00000’ means “no error.” The values are specified by ANSI SQL and ODBC

    This page and its subpages should tell you all you need to know:
    http://dev.mysql.com/doc/refman/5.0/en/error-handling.html

    And here’s a list of SQLSTATE errors from IBM that goes into the structure behind the 5 character error code: http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls520.htm

    A quote:

    The following table is a quick reference for interpreting class code values.

    SQLSTATE 
    Class_Code_Value  Outcome
     00               Success 
     01               Success with warning 
     02               No data found 
     >= 03            Error or warning 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does Microsoft Access have Full Text Search? I know that MySQL and SQL Server
I know that with mysql you can write SQL statements into a .sql file
I know that mySQL 5.x does not support INTERSECT, but that seems to be
When i set lower_case_table_names = 1 in mysql i know that it converts every
I know that I can do something like $int = (int)99; //(int) has a
Is there a way that I can check for specific errors in MySQL with
I have a python script that connects to a local MySQL db. I know
In my MySQL installation I have one InnoDB database that I know will grow
In PHP, I know that mysql_real_escape is much safer than using addslashes . However,
I know that default cron's behavior is to send normal and error output to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.