1

I would appreciate any help I can get in terms of this topic. In this code:

else if (SQL_error.getErrorCode() == 04088)
{
    JOptionPane.showMessageDialog(null, "Error during execution of trigger. Contact administrator. The data logic is faulty. Please recheck logic.", "Error Message", JOptionPane.ERROR_MESSAGE);
    //System.out.println("The data logic is faulty. Please recheck logic.");
}

I keep on getting an error message when I hover over 04088. It says: "Number format error." Does anyone have any experience with this issue? I only find string to number conversions.

2
  • "Numbers" starting with 0 might be of type String, otherwise you could not distinguish between 007 and 07. Check the return type of getErrorCode. Commented Dec 17, 2015 at 20:07
  • I just checked new SQLException().getErrorCode() has return type int, so the answer by @fabian not only is correct but does not hide this possible other sorce of error. Commented Dec 17, 2015 at 20:15

2 Answers 2

6

Integers starting with 0 and continuing with other digits are interpreted as octal numbers. Since the highest digit in octal numbers is 7, 04088 is invalid.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer. I have to keep it as 04088. Is there a way to get around this?
0

I got the answer. Octals are used for representing file permissions on Unix systems. This is one of the reasons why Java uses octal numbers (apart from getting it derived from C). Now, back to the question, 04088 is an octal number. In order to be able to use it (even hard-coding it in Java did not help), you have to transform it into a floating point number. Therefore, when you use 04088, you have to put it as 04088F.

                        else if (SQL_error.getErrorCode() == 04088F) 
                    {
                        System.out.println("" + (String.valueOf(SQL_error.getErrorCode() == 04088F)));
                        JOptionPane.showMessageDialog(null, "Error during execution of trigger. Contact administrator. The data logic is faulty. Please recheck logic.", "Error Message", JOptionPane.ERROR_MESSAGE);
                        //System.out.println("The data logic is faulty. Please recheck logic.");
                    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.