# Metricbeat (SQL Module) connection issue to MS SQL

**URL:** <https://discuss.elastic.co/t/metricbeat-sql-module-connection-issue-to-ms-sql/366947>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 23, 2024, 9:19am UTC](https://discuss.elastic.co/t/metricbeat-sql-module-connection-issue-to-ms-sql/366947 "2024-09-23T09:19:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhl0129](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jhl0129](https://discuss.elastic.co/u/jhl0129)\
**Post date:** [September 23, 2024, 9:19am UTC](https://discuss.elastic.co/t/metricbeat-sql-module-connection-issue-to-ms-sql/366947/1 "2024-09-23T09:19:17Z")

</div>

Hi Team,

We're trying to use metricbeat sql module to run custom query on MS SQL.

To connect to MS SQL using a domain account, what should we put in the "hosts" portion of sql.yml?

We've tried the following but can't seem to work:

```auto
**---------------------------------------------------------**
   - module: sql
         metricsets:
   - query
        period: 10s
        hosts: ["sqlserver://dbipaddress:50000"]
        username: domain\username
        password: password

     driver: "mssql"
     sql_query: "XXXX"
**----------------------------------------------------------**

```

We keep seeing error that says that it keeps trying to connect to localhost.

Is it the correct format to connect to MS SQL using a domain account for sql module?

Please advise. Thanks!

Regards.
