cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Capturing Oracle JDBC SQL error codes and warnings

Hello all,

I am trying to do the following. I need to be able to report on SQL error codes with the message and state. I have created an agent group to capture the following methods:

getMessage() 

getErrorCode()

getState()

for the classes java.sql.SQLWarning and java.sql.SQLException and applied them to the appropriate agent groups. I have verified that the sensor are applied via the deployed sensors. The problem is that even where there are problems with a database call, I am not seeing the invocation of these methods in the purepaths.

Any suggestions?

Regards,

José Miguel Colella

7 REPLIES 7

gabriel_casella
Dynatrace Pro
Dynatrace Pro

Would these methods be called when the SQL error happens?!

Hello @Gabriel C.,

From the Oracle documentation on this:

"When JDBC encounters an error during an interaction with a data source, it throws an instance of SQLException". So I would expect to get that SQLException call after instrumenting the class. One thing that comes to mind is that an OOB sensor is doing a global exclude of the java.sql class.

Note I also added a sensor for the init seeing that it throws an instance of the SQLException class.

Hummmm,

Check the Exceptions Sensor Pack, on the Sensor Group that this should happen, to see if there is a class name exclusion based on classes that start with 'java.'

Also, as you have said, remember to check the OOB sensor pack (server settings) as well.

Let me know whether that works.

"Check the Exceptions Sensor Pack, on the Sensor Group that this should happen, to see if there is a class name exclusion based on classes that start with 'java.'"

And to this point, you would definitely be able to get the information you need by just using the default Exceptions dashlet. Make sure they are not being excluded.

"Would these methods be called when the SQL error happens?!"

I would check this as well. If user code is not executing the methods, than you won't be able to capture its execution - and consequently its return values.

In other words, to actually get to use the methods you listed, you would have to get a hold of the Exception object and maybe use the accessor. Although I am not sure if these methods really are accessors.

Indeed.

But, mostly sure that they are accessors if they are 'get()' methods (and follow the standard).

dave_mauney
Dynatrace Champion
Dynatrace Champion

Hi Jose,

Did you uncheck the "Ignore getter and setter methods" flag in the Agent Group/Sensor Placement dialog? Until I did that, these methods would not appear in the agent status/Deployed Sensors tab.

HTH,

dave