Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

The JDBC API lists a includeThreadNamesAsStatementComment parameter that seems to indicate it will prefix all queries with the Java thread ID. I thought this would be useful in tying back DB activity to application logs. I added it to my resource URLs and it seemed to only be working part of the time.

Curiously it was only the applications heartbeat thread that periodically pings the database as part of a health check. None of the "real" queries were getting tagged.

Why isn't this working for all queries?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

It turns out there's a known bug where this only works when calling the the JDBC API directly. It does not work when building queries through something like SimpleJDBCTemplate. All of the applications real work was being done using templates whereas the healtcheck threads were using the direct API.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.