Rithanya Laxmi wrote:No James, I have not extracted the errorcode, I thougt of using ":" as a delimeter to extract the error code & message. But since the error message contains few more ":" (actual: 302, maximum: 255) .
I guess it depends on where these error messges are and why you're doing this.
If they're in a log file, then I suspect you may have all sorts of other messages that you don't want to parse. However, if you're doing this inside your program and ONLY on SQLException's, there'll be a lot less work.
Either way, I suspect you'll want to use something like
String.startsWith() to make sure you're actually parsing the right kind of message.
Personally, if I was trying to do this, I'd probably do something like:
because then I'd know that any array it returns whose length is 2 was an Oracle error message
with a colon.
But it's only ONE way of doing it.
Winston