Input-jdbc : Error to connect to DB


#1

Hi,

I am using jdbc input plugin (version : 1.0.0) to push the data from postgres to elastic. But I get an error as:

  Java::OrgPostgresqlUtil::PSQLException: The server requested password-based authentication, but no password was provided.

Logstash conf details:

  # file: simple-out.conf
    input {
        jdbc {
            
            jdbc_connection_string => "jdbc:postgresql://localhost:5432/postgres"
            jdbc_user => "postgres"
            jdbc_password => "admin"
            jdbc_driver_library => "/PATH/TO/jdbc/postgresql-9.4-1202.jdbc41.jar"
            jdbc_driver_class => "org.postgresql.Driver"
            statement => "SELECT * from contacts"
        }
    }
    output {
        stdout { codec => json_lines }
    }

In postgres, I have a db called as postgres, with a user as 'postgres' and changed the password to 'admin'
SQL statement:

alter user postgres password 'admin'

Java version on my mac is:

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

And postgres version

> PostgreSQL 9.4.4 on x86_64-apple-darwin, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00), 64-bit 

Am I missing something?

Thanks
K


#2

After changing the java version to 1.7.* it started to work again!
But on start of Logstash, I do get a warning to upgrade to JAVA 8.


(Tal Levy) #3

According to the Postgresql JDBC driver documentation, they recommend using the JDBC42 version when
running using Java 8.

If you are using 1.7 then you should use the JDBC41 version. If you are using 1.8 then you should use the JDBC42 versionIf you are using a java version older than 1.6 then you will need to use a JDBC3 version of the driver, which will by necessity not be current
source: https://jdbc.postgresql.org/download.html

@Kiranpatil, maybe you can try this on Java 8? by using this driver: https://jdbc.postgresql.org/download/postgresql-9.4-1203.jdbc42.jar


(system) #4