Skip to content

Commit

Permalink
Load the driver with the system class loader. Fixes issue loading som…
Browse files Browse the repository at this point in the history
…e JDBC drivers in Logstash 6.2+ Fixes #263

Fixes #276
  • Loading branch information
jakelandis committed Mar 26, 2018
1 parent ad98446 commit dcd8b8d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.3.7
- [#263](https://github.com/logstash-plugins/logstash-input-jdbc/issues/263) Load the driver with the system class loader. Fixes issue loading some JDBC drivers in Logstash 6.2+

## 4.3.6
- [#274](https://github.com/logstash-plugins/logstash-input-jdbc/issues/274) Fix regression with 4.3.5 that can result in NULL :sql_last_value depending on timestamp format

Expand Down
3 changes: 2 additions & 1 deletion lib/logstash/plugin_mixins/jdbc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def jdbc_connect
def load_drivers(drivers)
drivers.each do |driver|
begin
require driver
class_loader = java.lang.ClassLoader.getSystemClassLoader().to_java(java.net.URLClassLoader)
class_loader.add_url(java.io.File.new(driver).toURI().toURL())
rescue => e
@logger.error("Failed to load #{driver}", :exception => e)
end
Expand Down
2 changes: 1 addition & 1 deletion logstash-input-jdbc.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'logstash-input-jdbc'
s.version = '4.3.6'
s.version = '4.3.7'
s.licenses = ['Apache License (2.0)']
s.summary = "Creates events from JDBC data"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
Expand Down

0 comments on commit dcd8b8d

Please sign in to comment.