diff --git a/README.md b/README.md index ac3ebe6..d5a5a69 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ Tests are not yet 100% complete. | Option | Type | Description | Required? | Default | | ------ | ---- | ----------- | --------- | ------- | +| driver_class | String | Specify a driver class if autoloading fails | No | | +| driver_auto_commit | Boolean | If the driver does not support auto commit, you should set this to false | No | True | | 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 | | | connection_string | String | JDBC connection URL | Yes | | | username | String | JDBC username - this is optional as it may be included in the connection string, for many drivers | No | | diff --git a/lib/logstash/outputs/jdbc.rb b/lib/logstash/outputs/jdbc.rb index b4ae84a..e666ebb 100644 --- a/lib/logstash/outputs/jdbc.rb +++ b/lib/logstash/outputs/jdbc.rb @@ -12,8 +12,11 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base config_name "jdbc" - # Driver class - No longer required - config :driver_class, :obsolete => "driver_class is no longer required and can be removed from your configuration" + # Driver class - Reintroduced for https://github.com/theangryangel/logstash-output-jdbc/issues/26 + config :driver_class, :validate => :string + + # Does the JDBC driver support autocommit? + config :driver_auto_commit, :validate => :boolean, :default => true, :required => true # Where to find the jar # Defaults to not required, and to the original behaviour @@ -81,6 +84,10 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base load_jar_files! @pool = Java::ComZaxxerHikari::HikariDataSource.new + + @pool.setAutoCommit(@driver_auto_commit) + @pool.setDriverClassName(@driver_class) if @driver_class + @pool.setJdbcUrl(@connection_string) @pool.setUsername(@username) if @username diff --git a/logstash-output-jdbc.gemspec b/logstash-output-jdbc.gemspec index c889fbe..cb0b812 100644 --- a/logstash-output-jdbc.gemspec +++ b/logstash-output-jdbc.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'logstash-output-jdbc' - s.version = "0.2.1" + s.version = "0.2.2.rc1" s.licenses = [ "Apache License (2.0)" ] s.summary = "This plugin allows you to output to SQL, via JDBC" 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"