Comments - About MariaDB Connector/J
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Hi, If performance_schema variable is activated, in Table performance_schema.session_connect_attrs, for each connection, you will have :
You can add specific information using option "connectionAttributes"
Sorry, updating the answer delete your comment. New version 1.5.4, Connection.setClientInfo() permit 3 differents Session-Specific Client Information :
This without having performance_schema variable activated.
Hi again, When will version 1.5.4 be released?
version 1.5.4 is available on maven central or will be available on site download in a few hours.
Great! So, I have a MariaDB 10.1.14 and the session_connect_attrs table does not have these three new parameters, and I create a short javascript that uses the new connector to make a short connection, make a simple select and then logout, what will happen? I tried to add new variables to this table but my user didn't have the permission to do it, nor did the root user. Obviously, I switched on the performance_schema.
I may have not been clear.
There is in fact 2 differents way to achieve that : standard JDBC : using connection , you can add some specific informations:
Properties properties = new Properties();
properties.setProperty("ApplicationName", "your application");
properties.setProperty("ClientUser", "your user");
properties.setProperty("ClientHostname", "myhost");
connection.setClientInfo(properties); and so after that, you will be able to retrieve those informations : String currentHost = connection.getClientInfo("myhost");
other solution is the first explain : If performance_schema variable is activated on server, in Table performance_schema.session_connect_attrs, for each connection, you will have :
You can add specific information using option "connectionAttributes" . Example connecting with url "jdbc:mariadb:localhost/db?user=xxx&connectionAttributes=key1:value1,key2,value2"
you will have then have 2 additionnals informations :
It works great, thank you so mcuh for the help and for all the fast responses!
Excellent, thanks!