Skip to content

Commit

Permalink
Addresses issue 26
Browse files Browse the repository at this point in the history
  • Loading branch information
theangryangel committed Dec 23, 2015
1 parent af55fde commit bfcd9bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand Down
11 changes: 9 additions & 2 deletions lib/logstash/outputs/jdbc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,6 +84,10 @@ def register
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
Expand Down
2 changes: 1 addition & 1 deletion logstash-output-jdbc.gemspec
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit bfcd9bf

Please sign in to comment.