Skip to content
This repository was archived by the owner on Sep 17, 2019. It is now read-only.

Commit bfcd9bf

Browse files
committed
Addresses issue 26
1 parent af55fde commit bfcd9bf

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Tests are not yet 100% complete.
4141

4242
| Option | Type | Description | Required? | Default |
4343
| ------ | ---- | ----------- | --------- | ------- |
44+
| driver_class | String | Specify a driver class if autoloading fails | No | |
45+
| driver_auto_commit | Boolean | If the driver does not support auto commit, you should set this to false | No | True |
4446
| driver_path | String | File path to jar file containing your JDBC driver. This is optional, and all JDBC jars may be placed in $LOGSTASH_HOME/vendor/jar/jdbc instead. | No | |
4547
| connection_string | String | JDBC connection URL | Yes | |
4648
| username | String | JDBC username - this is optional as it may be included in the connection string, for many drivers | No | |

lib/logstash/outputs/jdbc.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
1212

1313
config_name "jdbc"
1414

15-
# Driver class - No longer required
16-
config :driver_class, :obsolete => "driver_class is no longer required and can be removed from your configuration"
15+
# Driver class - Reintroduced for https://github.com/theangryangel/logstash-output-jdbc/issues/26
16+
config :driver_class, :validate => :string
17+
18+
# Does the JDBC driver support autocommit?
19+
config :driver_auto_commit, :validate => :boolean, :default => true, :required => true
1720

1821
# Where to find the jar
1922
# Defaults to not required, and to the original behaviour
@@ -81,6 +84,10 @@ def register
8184
load_jar_files!
8285

8386
@pool = Java::ComZaxxerHikari::HikariDataSource.new
87+
88+
@pool.setAutoCommit(@driver_auto_commit)
89+
@pool.setDriverClassName(@driver_class) if @driver_class
90+
8491
@pool.setJdbcUrl(@connection_string)
8592

8693
@pool.setUsername(@username) if @username

logstash-output-jdbc.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'logstash-output-jdbc'
3-
s.version = "0.2.1"
3+
s.version = "0.2.2.rc1"
44
s.licenses = [ "Apache License (2.0)" ]
55
s.summary = "This plugin allows you to output to SQL, via JDBC"
66
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"

0 commit comments

Comments
 (0)