33require "logstash/namespace"
44require "logstash/plugin_mixins/jdbc/jdbc"
55
6+ # this require_relative returns early unless the JRuby version is between 9.2.0.0 and 9.2.8.0
7+ require_relative "tzinfo_jruby_patch"
68
79# This plugin was created as a way to ingest data from any database
810# with a JDBC interface into Logstash. You can periodically schedule ingestion
8486# The file option only supports one SQL statement. The plugin will only accept one of the options.
8587# It cannot read a statement from a file as well as from the `statement` configuration parameter.
8688#
87- # ==== Configuring multiple SQL statements
89+ # ==== Configuring multiple SQL statements
8890#
89- # Configuring multiple SQL statements is useful when there is a need to query and ingest data
90- # from different database tables or views. It is possible to define separate Logstash
91- # configuration files for each statement or to define multiple statements in a single configuration
92- # file. When using multiple statements in a single Logstash configuration file, each statement
93- # has to be defined as a separate jdbc input (including jdbc driver, connection string and other
94- # required parameters).
91+ # Configuring multiple SQL statements is useful when there is a need to query and ingest data
92+ # from different database tables or views. It is possible to define separate Logstash
93+ # configuration files for each statement or to define multiple statements in a single configuration
94+ # file. When using multiple statements in a single Logstash configuration file, each statement
95+ # has to be defined as a separate jdbc input (including jdbc driver, connection string and other
96+ # required parameters).
9597#
96- # Please note that if any of the statements use the `sql_last_value` parameter (e.g. for
97- # ingesting only data changed since last run), each input should define its own
98+ # Please note that if any of the statements use the `sql_last_value` parameter (e.g. for
99+ # ingesting only data changed since last run), each input should define its own
98100# `last_run_metadata_path` parameter. Failure to do so will result in undesired behaviour, as
99- # all inputs will store their state to the same (default) metadata file, effectively
101+ # all inputs will store their state to the same (default) metadata file, effectively
100102# overwriting each other's `sql_last_value`.
101103#
102104# ==== Predefined Parameters
@@ -178,11 +180,11 @@ module LogStash module Inputs class Jdbc < LogStash::Inputs::Base
178180 # Whether to force the lowercasing of identifier fields
179181 config :lowercase_column_names , :validate => :boolean , :default => true
180182
181- # The character encoding of all columns, leave empty if the columns are already properly UTF-8
183+ # The character encoding of all columns, leave empty if the columns are already properly UTF-8
182184 # encoded. Specific columns charsets using :columns_charset can override this setting.
183185 config :charset , :validate => :string
184186
185- # The character encoding for specific columns. This option will override the `:charset` option
187+ # The character encoding for specific columns. This option will override the `:charset` option
186188 # for the specified columns.
187189 #
188190 # Example:
@@ -199,6 +201,8 @@ module LogStash module Inputs class Jdbc < LogStash::Inputs::Base
199201 # this will only convert column0 that has ISO-8859-1 as an original encoding.
200202 config :columns_charset , :validate => :hash , :default => { }
201203
204+ attr_reader :database # for test mocking/stubbing
205+
202206 public
203207
204208 def register
0 commit comments