Skip to content

Commit dcd8b8d

Browse files
committed
Load the driver with the system class loader. Fixes issue loading some JDBC drivers in Logstash 6.2+ Fixes #263
Fixes #276
1 parent ad98446 commit dcd8b8d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.3.7
2+
- [#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+
3+
14
## 4.3.6
25
- [#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
36

lib/logstash/plugin_mixins/jdbc.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ def jdbc_connect
135135
def load_drivers(drivers)
136136
drivers.each do |driver|
137137
begin
138-
require driver
138+
class_loader = java.lang.ClassLoader.getSystemClassLoader().to_java(java.net.URLClassLoader)
139+
class_loader.add_url(java.io.File.new(driver).toURI().toURL())
139140
rescue => e
140141
@logger.error("Failed to load #{driver}", :exception => e)
141142
end

logstash-input-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-input-jdbc'
3-
s.version = '4.3.6'
3+
s.version = '4.3.7'
44
s.licenses = ['Apache License (2.0)']
55
s.summary = "Creates events from JDBC data"
66
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"

0 commit comments

Comments
 (0)