DB2 Exception handling - exception

The problem that I am facing is primarily on Exception Handling! When an exception occurs I want to put that data in another log table with the error message. However, in DB2 I am not able to figure out a way to retrieve the corresponding error message for the raised SQLSTATE.
PS: I have a stored procedure for this migration and I am not using any other language to call it.
We could do this through SQLERRM in oracle; probably it should be a small thing, still for some strange reasons I have not been able to find it yet!
Hopefully you would have an idea on this, ;-). I just need a pointer on this.
Thanks,
Harveer Uppal

DB2 has an SQLERRM function too. All you need to to is capture all of the tokens from the error and feed them into the function for the equivalent message you'd get from the CLP.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0022027.html

You should be able to get in the front-end code using DB2Exception.Message property.

Related

Can an exception be used by more than one trigger? Is there a general exception that can be used by any trigger?

About 18 months ago, I created an exception for a trigger which works fine. Now, when I have tried to create a new exception for a new trigger, it looks more like an error. So the trigger still compiles and the exception still halts the trigger, but it does not look professional. It says:
I would expect just:
But with the message "Supplier Required in Line Source Tab."
I guess my question wasn't clear enough and for this I apologise. With lots of exceptions which do nothing else than to inform the user there is an issue and what it is, then why not just create one exception and change the message each time? I believe that somehow an exception belongs to a particular trigger. If that is the case, how is this done?
How your application display errors is not directly related to how these errors are raised. ISC API Guide describe how to parse status vector and recognize gdscodes so you can extract exception message and show it ignoring the rest.

Errors within nested views always show a vague error message. Can it be made more verbose?

I'm using View Composers and nested views in general to build my layouts, and whenever any PHP errors are encountered, it always shows a generic Method Illuminate\View\View::__toString() must not throw an exception error message. Is there a way for it to show the actual error without having to guess what it is? Or is this limitation of PHP impossible to get around?
The error log also shows the same vague message, so that isn't a solution either.

Entity Exception Message At least one of the input paths is not valid because either it is too long or it has incorrect format

using EF4
I atempt to make a connection but get this error message
"Entity Exception Message At least one of the input paths is not valid because either it is too long or it has incorrect format."
This used the example from http://msdn.microsoft.com/en-us/library/bb738533.aspx but passing in my own server name. What is the "input paths"
When I run it from a web app its fine, when I try and run it in a unit/integration test passing in the connection (as app.config might not be there) I get this error.
Whats going on?
I had the same issue. I was writing the code in the following way
ebuilder.Metadata = #"Model1.csdl, Model1.ssdl,Model1.msl";
Then after some research I changes it to
ebuilder.Metadata = #"res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl";
The magic happened and it started working.
I had same error in EF6. when I try to fetch something from DB, this error was thrown.
I solved this problem with correcting the MetaData part of my connectinString.
you must have MetaData part like below:
metadata=res:///myModel.csdl|res:///myModel.ssdl|res://*/myModel.msl;

BizTalk 2006 R2 schema validation specific error message with failed message routing

I'm looking for a way to catch the actual exception thrown by BizTalk 2006 R2 when a receive port can't parse a message it picks up.
For example, I have a csv file that was not properly created, say it's missing a comma, so when BizTalk tries to determine the message type, it errors out. Without using failed message routing, there are 2 entries in the application event log. One has a pretty generic error description, something along the lines of "The Messaging Engine encountered an error during the processing of one or more inbound messages." The second entry has what I'm looking for. It will contain the details of where the missing comma is, something along the lines of "Unexpected data found while looking for:
','
The current definition being parsed is POSTrailer. The stream offset where the error occured is 44443. The line number where the error occured is 244. The column where the error occured is 1."
I've tried using the ESB toolkit Exception Handler for BizTalk 2006 R2. Using failed message routing and their exception handing framework, the error description it catches is the first, generic, error description.
I do not see any way to obtain the second, more detailed error description. I'm assuming somewhere in the bowels of the biztalk messaging engine this exception is getting thrown, which is caught by something a little bit higher in the process, which throws it's own generic biztalk exception. I would also assume that the more specific error description is contained as the inner exception of the exception that gets routed to the ESB toolkit, however by the time I can get a hold of it, as far as I can tell, the actual exception object has been replaced by the message context, which is nothing more than a bunch of name/value pairs. The error description is now the generic one that is not helpful, and anything resembling an inner exception is just a hexidecmal code, which means nothing to my end users.
Everything I've found regarding obtaining a specific error message deals with exceptions thrown from an orchestration. I am not dealing with an orchestration, though, I'm dealing with a receive port. The closest thing I can find is here. But even if I could create a custom pipeline component using that, that means I either need to add that component into every exising custom pipline, or create a new one to validate XML and use that instead of the XMLRecieve or XMLSend pipelines that come with BizTalk... That also means trapping errors generated from EDI is out of the question. Does anyone know of a way to get at this more detailed error description from the BizTalk generated error message?
I'm not sure of a tool that will do exactly what you're looking for, but I do have a couple of options.
1) I'm pretty sure SCOM can grab those errors and alert whoever needs to be alerted. I've had some problems with this in the past, though, so it may not be your best bet.
2) For basic Failure handling, you can write code to scrape the EventLog for any warning or error from BizTalk and pass that down the line (my current client does this- it's not super elegant, but it works well).
3) What I would encourage- if you don't want orchestrations- is to set up custom pipelines which simply implement your error handling/monitoring in addition to your normal operations. Then, for non-critical messages, you can still use the standard pipelines (reducing overhead/latency) and for critical messages you can use your "GuaranteedDeliveryPassThruPipeline" or your "GuaranteedDeliveryXMLTransmitPipeline" or whatever.

How to trace COM objects exceptions?

I have a DLL with some COM objects. Sometimes, this objects crashes and register an error event in the Windows Event Log with lots of hexadecimal informations. I have no clue why this crashes happens.
So, How can I trace those COM objects exceptions?
The first step is to lookup the Fail code's hex value (E.G. E_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means.
Then, I just use trial and error to try to isolate the location in code that's failing, and the root cause of the failure.
If you just want a really quick way to find out what the error code means, you could use the "Error Lookup" tool packaged with Visual Studio (details here). Enter the hex value, and it will give you the string describing that error code.
Of course, once you know that, you've still got to figure out why it's happening.
A good way to look up error (hresult) codes is HResult Plus or welt.exe (Windows Error Lookup Tool).
I use logging internally in the COM-classes to see what is going on. Also, once the COM-class is loaded by the executable, you can attach the VS debugger to it and debug the COM code with breakpoints, watches, and all that fun stuff.
COM objects don't throw exceptions. They return HRESULTs, most of which indicate a failure. So if you're looking for the equivalent of an exception stack trace, you're out of luck. You're going to have to walk through the code by hand and figure out what's going on.