#14 Get the root cause of a CannotAcquireResourceException

open
nobody
None
5
2007-08-06
2007-08-06
Christian Gruber
No

Hello!

When a CannotAcquireResourceException is thrown because the data source is not available, the reason why this happened cannot be determined out of the exception. The reason is logged, but I would like to have this information available programmatically, preferrably directly out of the CannotAcquireResourceException.

Right now, the message of the exception only reads "A ResourcePool could not acquire a resource from its primary factory or source", which is not very helpful. The CannotAcquireResourceException already implements the PotentiallySecondary interface with its getNestedThrowable() method; could the primary SQLException why the connection could not be acquired be made available here?

Thanks in advance,
Christian

Discussion