2015-12-30 12:04:23 +00:00
# Example: SQL Server
* Tested using http://msdn.microsoft.com/en-gb/sqlserver/aa937724.aspx
2016-05-13 21:32:31 +00:00
* Known to be working with Microsoft SQL Server Always-On Cluster (see https://github.com/theangryangel/logstash-output-jdbc/issues/37). With thanks to [@phr0gz ](https://github.com/phr0gz )
2015-12-30 12:04:23 +00:00
```
input
{
stdin { }
}
output {
jdbc {
2017-04-12 10:59:15 +00:00
driver_jar_path => '/opt/sqljdbc42.jar'
2016-05-13 21:32:31 +00:00
connection_string => "jdbc:sqlserver://server:1433;databaseName=databasename;user=username;password=password"
2015-12-30 12:04:23 +00:00
statement => [ "INSERT INTO log (host, timestamp, message) VALUES(?, ?, ?)", "host", "@timestamp", "message" ]
}
2017-04-12 10:59:15 +00:00
}
```
2017-04-12 11:35:56 +00:00
Another example, with mixed static strings and parameters, with thanks to [@MassimoSporchia ](https://github.com/MassimoSporchia )
2017-04-12 10:59:15 +00:00
```
input
{
stdin { }
}
output {
jdbc {
driver_jar_path => '/opt/sqljdbc42.jar'
connection_string => "jdbc:sqlserver://server:1433;databaseName=databasename;user=username;password=password"
statement => [ "INSERT INTO log (host, timestamp, message, comment) VALUES(?, ?, ?, 'static string')", "host", "@timestamp", "message" ]
}
2015-12-30 12:04:23 +00:00
}
```