6

Is there a way to specify the Program name for an entry in the process list? Usually, all the connections say 'None' or 'MySQLWorkbench'. There was one case where I actually saw the name of the .exe I was running in the list of connections but I don't know why.

Here's a picture of what I'm talking about from the MySQLWorkbench Client Connections management page.

List of Program Name in MySQl Client Connections

I'm using Connector/Net 6.9.6, and I didn't see anything in the connection string options.

chriszumberge
  • 844
  • 2
  • 18
  • 33
  • According to [this post](http://mysqlblog.fivefarmers.com/2013/03/26/connection-attributes-in-mysql-5-6/), it's the program_name attribute which Connector/Net may let you set. See the Java Connector example for a start. – xathien Apr 29 '15 at 15:28
  • According to [the docs](http://dev.mysql.com/doc/connector-net/en/connector-net-connection-options.html) under the Connect_attrs variable, you can specify this stuff, though [this open bug](https://bugs.mysql.com/bug.php?id=75322) seems to disagree. – xathien Apr 29 '15 at 15:32
  • Thanks for the links, the docs said the program name should be sent over automatically, which it obviously is not. I tried using the Connect_attrs variable as well but it also did not work so I can confirm that bug for Connector/Net 6.9.6 – chriszumberge Apr 29 '15 at 19:28
  • I need this support too. Nothing new on the Oracle bug report (https://bugs.mysql.com/bug.php?id=75322). You guys found a solution? – jhovgaard Aug 12 '15 at 11:30
  • @jhovgaard I have not found a solution yet – chriszumberge Aug 12 '15 at 20:08
  • @jhovgaard for whats it's worth- I started creating different users for each different app's connection string. Then I can see the client connections by user. – chriszumberge Mar 28 '16 at 21:03
  • @chriszumberge thanks :-) – jhovgaard Mar 29 '16 at 13:14
  • 1
    @chriszumberge Check the answer of this question : https://stackoverflow.com/questions/51848391/add-application-name-in-mysql-connection-string/51850707#51850707 – Micheal Choudhary Aug 14 '18 at 23:44

2 Answers2

0

I've found the solution for that, you just need to add the following string in the URL: &connectionAttributes=program_name:[APP_NAME]

  • [APP_NAME] change by your application name or anything that you want.
0

The "Program Name" column in MySQL Workbench comes from a program_name connection attribute. The MySQL documentation incorrectly claims that:

MySQL Connector/NET defines these attributes:

  • _program_name: The client name

This is wrong in two ways: the attribute name has a typo (leading underscore) and the code that sets it was deleted.

There is no way (a connection string setting or otherwise) to set the value of this attribute in MySQL Connector/NET. Furthermore, the connection attributes are part of the initial handshake so there is no way to set them after the connection is established (e.g., in your application code).

If you're willing to change ADO.NET connector libraries, the MySqlConnector library added support for an Application Name connection string option in v0.44.0; this will let you control the connection attribute that's sent to the server (and it will show up in MySQL Workbench).

Bradley Grainger
  • 27,458
  • 4
  • 91
  • 108