MySQL Connector/Java supports connection attributes since version 5.1.25. This projects useful metadata about the client environment into the database, where MySQL administrators can query PERFORMANCE_SCHEMA tables to remotely survey application deployment environments. One useful piece of information exposed is the version and vendor of the JVM in use by the client. This very short blog demonstrates how to get this information from PERFORMANCE_SCHEMA.
The metadata including the Java runtime environment version and vendor can be found in PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS table. Here’s the full contents of that table for a single connection from Connector/Java:
mysql> SELECT * -> FROM PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS -> WHERE processlist_id = 31\G *************************** 1. row *************************** PROCESSLIST_ID: 31 ATTR_NAME: _runtime_version ATTR_VALUE: …[Read more]