# JDBC integrated security

**URL:** <https://discuss.elastic.co/t/jdbc-integrated-security/54157>\
**Category:** Logstash\
**Created:** [June 28, 2016, 11:55am UTC](https://discuss.elastic.co/t/jdbc-integrated-security/54157 "2016-06-28T11:55:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tollef](https://avatars.discourse-cdn.com/v4/letter/t/85e7bf/32.png) [@tollef](https://discuss.elastic.co/u/tollef)\
**Post date:** [June 28, 2016, 11:55am UTC](https://discuss.elastic.co/t/jdbc-integrated-security/54157/1 "2016-06-28T11:55:14Z")

</div>

Hello.

I'm currently in a POC stage in a project and have to collect data from a MS SQL Server.

I am using jdbc-input-plugin to connect to the database.

dbtest.conf  
`input {  
jdbc {  
jdbc\_driver\_library =\> "C:\jdbc\jdbc\_driver\sqljdbc\_6.0\enu\sqljdbc42.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
jdbc\_connection\_string =\> "jdbc:sqlserver://localhost:1433;Data Source=;Initial Catalog=;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"  
jdbc\_user =\> ""  
schedule =\> "\* \* \* \* \*"  
statement =\> "SELECT \* FROM dbo.tblActivityLog"  
}  
}

output {  
stdout {  
codec =\> 'rubydebug'  
}  
}`

jdbc-user is a required field in the jdbc plugin, but seems to stop me from using integrated security. I have tried different versions, including an empty jdbc-user, the windows user (with and without the password), and other users that should have access.

I get "Login failed for user for all attempts.  
Is there a workaround for using Integrated security, or maybe another software I can use for forwarding to logstash (similar to winlogbeat for eventlogs)?

Let me know if more information is needed.

Edit: I see there is a github issue for this from february [github issue](https://github.com/logstash-plugins/logstash-input-jdbc/issues/118)  
The Issue does not look like a priority for the devs, since the other issues have priorityflags.

---

<div class="post-metadata">

**Author:** ![tollef](https://avatars.discourse-cdn.com/v4/letter/t/85e7bf/32.png) [@tollef](https://discuss.elastic.co/u/tollef)\
**Post date:** [June 28, 2016, 1:53pm UTC](https://discuss.elastic.co/t/jdbc-integrated-security/54157/2 "2016-06-28T13:53:09Z")

</div>

I have found a temporary solution. By creating an extra login credential on the server with sql server authorization I were able to get access without using Integrated Security.

This might not be a possible solution for our project. If anyone have a better solution I would love to hear about it!

---

<div class="post-metadata">

**Author:** ![gpcmol](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gpcmol](https://discuss.elastic.co/u/gpcmol)\
**Post date:** [August 7, 2016, 2:20pm UTC](https://discuss.elastic.co/t/jdbc-integrated-security/54157/3 "2016-08-07T14:20:19Z")

</div>

It took me a while to figure out how I could query SQL Server. (since i'm not a Windows/Sqlserver expert 😉  
This is what I did (I'musing Logstash 2.3.2)

First add a login to SQLServer (e.g. username=logstash, password=logstash):  
[https://www.youtube.com/watch?v=3Lz9rFVRRfU](https://www.youtube.com/watch?v=3Lz9rFVRRfU)

Then enable TCP in SQL Server Configuration Manager  
Look under SQL Server Network Configuration \> set TCP on enabled and add port 1433 as in this video:

> **[telnet localhost 1433 not working](https://krishna21e.wordpress.com/2015/04/07/telnet-localhost-1433-not-working/)**
>
> After SQL installation, when you telnet to localhost with sql port 1433 it would give the error as could not open the connection to the host, on port 1433: connection failed Goto SQL server configu…

try to: telnet localhost 1433  
If this is right configure Logstash as follows:

input {  
jdbc {  
jdbc\_driver\_library =\> "C:\progs\sqljdbc\_4.2\enu\sqljdbc42.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
jdbc\_connection\_string =\> "jdbc:sqlserver://HOSTNAME\INSTANCENAME:1433;databaseName=DBNAME"  
jdbc\_user =\> "logstash"  
jdbc\_password =\> "logstash"  
statement =\> "SELECT \* from TABLE"  
jdbc\_paging\_enabled =\> "true"  
jdbc\_page\_size =\> "50000"  
}  
}

output {  
stdout { codec =\> json\_lines }  
}

---

<div class="post-metadata">

**Author:** ![Julian\_Fazri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_fazri/32/15921_2.png) [@Julian\_Fazri](https://discuss.elastic.co/u/Julian_Fazri)\
**Post date:** [April 24, 2017, 5:26pm UTC](https://discuss.elastic.co/t/jdbc-integrated-security/54157/4 "2017-04-24T17:26:57Z")

</div>

could we encrypt the password string? if can, what encryption that used?

---

<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:** [July 6, 2017, 4:26am UTC](https://discuss.elastic.co/t/jdbc-integrated-security/54157/5 "2017-07-06T04:26:55Z")

</div>


