# MSSQL jdbc jdbc\_user with DomainName

**URL:** <https://discuss.elastic.co/t/mssql-jdbc-jdbc-user-with-domainname/217842>\
**Category:** Logstash\
**Created:** [February 4, 2020, 3:16pm UTC](https://discuss.elastic.co/t/mssql-jdbc-jdbc-user-with-domainname/217842 "2020-02-04T15:16:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)\
**Post date:** [February 4, 2020, 3:16pm UTC](https://discuss.elastic.co/t/mssql-jdbc-jdbc-user-with-domainname/217842/1 "2020-02-04T15:16:28Z")

</div>

Hi everyone  
in Logstash pipeline I have the following connection string:  
jdbc\_user =\> "DomainName\UserName"  
But looks like using "" is not working

```
input {
jdbc {
    jdbc_validate_connection => true
    jdbc_driver_library => "/opt/sqljdbc41.jar"
    jdbc_driver_class => "jdbc:com.microsoft.jdbc.sqlserver.SQLServerDriver"
    jdbc_connection_string => "microsoft:sqlserver://10.91.18.56:1433;DatabaseName=master"
    jdbc_user => "myDomain\myDBUser"
    jdbc_password => "myPwd"
    statement => "select 1"
    schedule => "*/1 * * * *"
    }
}
  filter {
}
output {
        stdout { codec => rubydebug }
}

```

The Error it throws is as following:

`Unable to connect to database. Tried 1 times {:error_message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: Login failed for user 'myDomain\\myDBUser'. ClientConnectionId:`

I have no way to get ride of Domain as the logstash is running on a different domain.

Can anyone come with a way to fix this?

Regards,  
Ginu

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [February 5, 2020, 10:51pm UTC](https://discuss.elastic.co/t/mssql-jdbc-jdbc-user-with-domainname/217842/2 "2020-02-05T22:51:58Z")

</div>

I believe that the double-backslash may be just a display artifact (sending `String#inspect` to a string will output a form that escapes literal backslashes with backslashes).

I'm seeing references in other projects that use the MSSQL JDBC Driver that the ODBC driver it is based on only supports Kerberos authentication.

See: unrelated python ODBC library: [https://github.com/mkleehammer/pyodbc/issues/272](https://github.com/mkleehammer/pyodbc/issues/272)

Microsoft ODBC docs: [https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-integrated-authentication](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-integrated-authentication)

---

<div class="post-metadata">

**Author:** ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)\
**Post date:** [February 6, 2020, 10:44am UTC](https://discuss.elastic.co/t/mssql-jdbc-jdbc-user-with-domainname/217842/3 "2020-02-06T10:44:38Z")

</div>

Thanks yaauie  
I had tried

> myDomain\myDBUser

which gives the following failure:

> Java::ComMicrosoftSqlserverJdbc::SQLServerException: Login failed for user 'myDomain\myDBUser'. ClientConnectionId:ce4a007d-f53f-4c58-9d82-e1d691e302af

apart from that I had also tried the followings without success:

> myDomain/\myDBUser  
> myDomain.myDBUser  
> myDomain@myDBUser

---

<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:** [March 5, 2020, 10:44am UTC](https://discuss.elastic.co/t/mssql-jdbc-jdbc-user-with-domainname/217842/4 "2020-03-05T10:44:38Z")

</div>

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