# Metricbeat MSSQL DB connection

**URL:** <https://discuss.elastic.co/t/metricbeat-mssql-db-connection/252519>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 19, 2020, 9:28am UTC](https://discuss.elastic.co/t/metricbeat-mssql-db-connection/252519 "2020-10-19T09:28:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kavi\_anand](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kavi\_anand](https://discuss.elastic.co/u/kavi_anand)\
**Post date:** [October 19, 2020, 9:28am UTC](https://discuss.elastic.co/t/metricbeat-mssql-db-connection/252519/1 "2020-10-19T09:28:51Z")

</div>

I need to monitor particular a DB in MSSQL server, Is there any way to specify the DB name in MSSQL module itself

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [October 19, 2020, 3:49pm UTC](https://discuss.elastic.co/t/metricbeat-mssql-db-connection/252519/2 "2020-10-19T15:49:37Z")

</div>

Hi @kavi_anand 🙂

You can use the fill `hosts` parameter to as the common connection string like `sqlserver://root:1234localhost?database=master&connection+timeout=30`

---

<div class="post-metadata">

**Author:** ![kavi\_anand](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kavi\_anand](https://discuss.elastic.co/u/kavi_anand)\
**Post date:** [November 6, 2020, 12:25pm UTC](https://discuss.elastic.co/t/metricbeat-mssql-db-connection/252519/3 "2020-11-06T12:25:18Z")

</div>

Hi Mario @Mario_Castro,  
I tried using your solution and got new problems, also we cannot have access for all the db access, i think it requires admin access which cannot be provided, is there any alternate way?  
hosts: ["sqlserver://servername:15001?database=test"]  
username: test1  
password: 123

error:

error doing ping to db: Login error: mssql: Cannot open database "test" that was requested by the login. Using the  
user default database "master" instead.; could not create connection to db: error doing ping to db: Login error: mssql:  
Cannot open database "test" that was requested by the login. Using the user default database "master" instead.  
Exiting: 2 errors: could not create connection to db: error doing ping to db: Login error: mssql: Cannot open database "  
Qualfx\_test" that was requested by the login. Using the user default database "master" instead.; could not create connec  
tion to db: error doing ping to db: Login error: mssql: Cannot open database "test" that was requested by the log  
in. Using the user default database "master" instead.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 4, 2020, 2:25pm UTC](https://discuss.elastic.co/t/metricbeat-mssql-db-connection/252519/4 "2020-12-04T14:25:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
