How to set the Application Name for a Sequelize ap

2019-07-15 03:54发布

I've got a nodejs application that uses Sequelize as it's ORM. I've successfully got Sequelize connected to the database, but I haven't found anything in the documentation that explains how to set the application name. To clarify I'm looking to set a unique Application Name attribute for my app's connection string. That way when a DBA is looking at traffic they can pick out my application's queries from the rest.

Is this something that Sequelize can even do? Or does this need to be done at the tedious level? Failing that, is there a way in nodejs to specify connection string attributes?

1条回答
The star\"
2楼-- · 2019-07-15 04:42

Tedious allows setting the app name with the appName config param. You should be able to set this via the dialectOptions object when creating your Sequelize connection:

var conn = new Sequelize('my_db', 'my_user', 'my_pass', {
  host: 'my_server',
  dialect: 'mssql',

  dialectOptions: {
    appName: 'my_app_name'
  }
});
查看更多
登录 后发表回答