I have a java application that connects to a Sybase database.
I want to log, at the application level, database connections that are hanging.
I am not sure this is possible, if so, help me on this issue.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If a connection actually “hangs”, it’s often a deadlock. The database is the best place to diagnose and log these problems in detail.
However, I know that the MS SQL Server driver will throw a pretty specific exception after a deadlock victim is chosen and from my (much more limited) experience with Java, I imagine the Sybase driver does the same. You could trap that exception from your application. Even if it’s a general exception, you might examine a stack trace or description and ascertain that it pertained to a lock issue.
This post mentions a
LockAcquisitionExceptionwith Java/Sybase.