# Input-jdbc : Error to connect to DB

**URL:** https://discuss.elastic.co/t/input-jdbc-error-to-connect-to-db/29349
**Category:** Logstash
**Created:** [September 15, 2015, 9:10pm UTC](https://discuss.elastic.co/t/input-jdbc-error-to-connect-to-db/29349 "2015-09-15T21:10:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Kiranpatil](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@Kiranpatil](https://discuss.elastic.co/u/Kiranpatil)
#### Post date: [September 15, 2015, 9:10pm UTC](https://discuss.elastic.co/t/input-jdbc-error-to-connect-to-db/29349/1 "2015-09-15T21:10:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Kiranpatil](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@Kiranpatil](https://discuss.elastic.co/u/Kiranpatil)
#### Post date: [September 22, 2015, 6:12am UTC](https://discuss.elastic.co/t/input-jdbc-error-to-connect-to-db/29349/2 "2015-09-22T06:12:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![talevy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talevy/32/44896_2.png) [@talevy](https://discuss.elastic.co/u/talevy)
#### Post date: [September 26, 2015, 7:44pm UTC](https://discuss.elastic.co/t/input-jdbc-error-to-connect-to-db/29349/3 "2015-09-26T19:44:05Z")

</div>

> [@Kiranpatil](#):
>
> postgresql

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](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](https://jdbc.postgresql.org/download/postgresql-9.4-1203.jdbc42.jar)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 5:27am UTC](https://discuss.elastic.co/t/input-jdbc-error-to-connect-to-db/29349/4 "2017-07-06T05:27:54Z")

</div>


