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

  • Home
  • SEARCH
  • 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 352069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:42:09+00:00 2026-05-12T11:42:09+00:00

SQLException.getSQLState retrieves the SQLState for the SQLException object. What are all the possible values

  • 0

SQLException.getSQLState retrieves the SQLState for the SQLException object. What are all the possible values that can be returned by this method? Can I use the value to identify specific errors that occurred in the database (i.e. can this value tell me if it was a PK violation, or a unique constraint, or column value too large, etc.)?

Also, the DatabaseMetaData.getSQLStateType() method is supposed to indicate whether the SQLSTATE returned by SQLException.getSQLState is X/Open (now known as Open Group) SQL CLI or SQL99. The only possible value for this should be DatabaseMetaData.sqlStateXOpen == 1 and DatabaseMetaData.sqlStateSQL99 == 2 but I am getting the value 0. Am I missing something?

Is there a way that I can determine the specific type of error that occurred in the DB using combinations from the above mentioned methods? Can I count on the values of SQLException.getSQLState? Are these values different from DB provider to DB provider?

  • 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-12T11:42:10+00:00Added an answer on May 12, 2026 at 11:42 am

    Official documents that include SQLStates can obviously be purchased, at a relatively high price, from ANSI and XOpen.
    But, the documentation for most databases have lists of SQLStates. Probably the most complete ( and accessible ) online listings are in the DB2 manuals. Check the DB2 Universal Messages manual, for instance. Oracle ( TechNet password required ) and Sybase, among others, also have online listings.

    As to the second question, this is the intent of SQLState, however, the various databases have varying degrees of compliance. For example, some map multiple native error messages to the same SQLState. For generic use, one should probably concentrate on the major code ( the first two characters of SQLState, ) then determine if more specific info is available in the minor code ( beyond 000. )

    http://www.jguru.com/faq/view.jsp?EID=46397

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 343k
  • Answers 344k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I Solved this problem by uninstalling 'Microsoft Visual Studio Web… May 14, 2026 at 5:33 am
  • Editorial Team
    Editorial Team added an answer A drop down list returns a single value, so in… May 14, 2026 at 5:33 am
  • Editorial Team
    Editorial Team added an answer The problem was that inside the html code in the… May 14, 2026 at 5:33 am

Related Questions

try { ... } catch (SQLException sqle) { String theError = (sqle).getSQLState(); ... }
SQLite3::SQLException: SQL logic error or missing database error when do insert, update and delete
Connection.close() may throw SqlException , but I have always assumed that it is safe
I got the following SQLException: invalid options in all7 Upon googling the error message,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.