# MSSQL Connection to Server Instance fails due to Connection String parsing

**URL:** https://discuss.elastic.co/t/mssql-connection-to-server-instance-fails-due-to-connection-string-parsing/244738
**Category:** Beats
**Tags:** metricbeat
**Created:** [August 12, 2020, 2:31pm UTC](https://discuss.elastic.co/t/mssql-connection-to-server-instance-fails-due-to-connection-string-parsing/244738 "2020-08-12T14:31:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![phebing](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@phebing](https://discuss.elastic.co/u/phebing)
#### Post date: [August 12, 2020, 2:31pm UTC](https://discuss.elastic.co/t/mssql-connection-to-server-instance-fails-due-to-connection-string-parsing/244738/1 "2020-08-12T14:31:35Z")

</div>

I would like to connect the Metricbeat MSSQL to a specific Instance of the sql server.  
Connecting to another server without an instance works fine, but i can't get it to work with an instance.

My yml file looks like this

```auto
    #-------------------------------- MS-SQL Module --------------------------------
    - module: mssql
      metricsets:
        - "transaction_log"
        - "performance"
      hosts: 'sqlserver://127.0.0.1\\Instance_Name'
      username: '${sql_user}'
      password: '${sql_pwd}'
      period: 10s
      enabled: true

```

Using double slash results in

```auto
    host parsing failed for mssql-transaction_log: error parsing URL: parse sqlserver://127.0.0.1\Instance_Name: invalid character "\\" in host name; host parsing failed for mssql-performance

```

Using a single slash results in

```auto
    could not create connection to db: error doing ping to db: lookup 127.0.0.1 nstance_Name: no such host;

```

---

<div class="post-metadata">

### Author: ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)
#### Post date: [August 12, 2020, 6:43pm UTC](https://discuss.elastic.co/t/mssql-connection-to-server-instance-fails-due-to-connection-string-parsing/244738/2 "2020-08-12T18:43:38Z")

</div>

What version of Metricbeat are you using?

Can you try with replacing the `\\` with `/`?

Shaunak

---

<div class="post-metadata">

### Author: ![phebing](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@phebing](https://discuss.elastic.co/u/phebing)
#### Post date: [August 13, 2020, 7:56am UTC](https://discuss.elastic.co/t/mssql-connection-to-server-instance-fails-due-to-connection-string-parsing/244738/3 "2020-08-13T07:56:51Z")

</div>

Thanks, the `/`worked.

Thought i tried it out before. Still a bit odd, since all other applications seem to use the `\` ([example](https://www.connectionstrings.com/microsoft-data-sqlclient/connection-to-a-sql-server-instance/)).  
Version is 7.5 btw.

---

<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: [September 10, 2020, 9:56am UTC](https://discuss.elastic.co/t/mssql-connection-to-server-instance-fails-due-to-connection-string-parsing/244738/4 "2020-09-10T09:56:56Z")

</div>

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