# Error: org.postgresql.Driver not loaded

**URL:** <https://discuss.elastic.co/t/error-org-postgresql-driver-not-loaded/155850>\
**Category:** Logstash\
**Created:** [November 8, 2018, 9:27am UTC](https://discuss.elastic.co/t/error-org-postgresql-driver-not-loaded/155850 "2018-11-08T09:27:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasitcboy](https://avatars.discourse-cdn.com/v4/letter/e/df705f/32.png) [@elasitcboy](https://discuss.elastic.co/u/elasitcboy)\
**Post date:** [November 8, 2018, 9:27am UTC](https://discuss.elastic.co/t/error-org-postgresql-driver-not-loaded/155850/1 "2018-11-08T09:27:50Z")

</div>

I have problem with jdbc\_driver\_library.

### ELK\_VERSION = 6.4.2

And I use Docker for elk.

when i run:

` /opt/logstash# bin/logstash --path.data=/opt/logstash/ -f /etc/logstash/conf.d/simple.conf`

Get Error:  
Error: org.postgresql.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc\_driver\_library?

> Exception: LogStash::ConfigurationError  
> Stack: /opt/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin\_mixins/jdbc/jdbc.rb:163:in `open_jdbc_connection' /opt/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:in `execute\_statement'  
> /opt/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:277:in `execute_query' /opt/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:263:in `run'  
> /opt/logstash/logstash-core/lib/logstash/pipeline.rb:409:in `inputworker' /opt/logstash/logstash-core/lib/logstash/pipeline.rb:403:in `block in start\_input'  
> ^C[2018-11-08T08:07:23,329][WARN][logstash.runner] SIGINT received. Shutting down.  
> [2018-11-08T08:07:24,688][INFO][logstash.pipeline] Pipeline has terminated {:pipeline\_id=\>"main", :thread=\>"#\<Thread:0x40ce6e2c run\>"}  
> ^C[2018-11-08T08:07:26,309][FATAL][logstash.runner] SIGINT received. Terminating immediately..  
> [2018-11-08T08:07:26,531][ERROR][org.logstash.Logstash] org.jruby.exceptions.ThreadKill

simple.conf :

> input {  
> jdbc {  
> type =\> "test"  
> jdbc\_driver\_library =\> "/etc/logstash/org.postgresql.jdbc4-8.3-603.jar"  
> jdbc\_driver\_class =\> "org.postgresql.Driver"  
> jdbc\_connection\_string =\> "jdbc:postgresql://xxxx:8080/dbname"  
> jdbc\_user =\> "xxxxx"  
> jdbc\_password =\> "xxxx"  
> jdbc\_page\_size =\> "50000"  
> record\_last\_run =\> true  
> #schedule =\> "\*/5 \* \* \* \*"  
> ###example statement  
> statement =\> "SELECT jj.id as id,  
> jjp.title as job,  
> FROM jobs AS jj  
> INNER JOIN jobs\_job AS jjp ON jj.id=jjp.job\_id  
> WHERE jj.active = true"
> 
> }  
> }

path to jdbc\_driver\_library:

> root@xxxxxxx:/etc/logstash# ls  
> conf.d mysql-connector-java-8.0.12.jar org.postgresql.jdbc4-8.3-603.jar  
> root@xxxxxxxxxx:/etc/logstash#

I do not understand why, because sometimes it works and sometimes does not work?

---

<div class="post-metadata">

**Author:** ![elasitcboy](https://avatars.discourse-cdn.com/v4/letter/e/df705f/32.png) [@elasitcboy](https://discuss.elastic.co/u/elasitcboy)\
**Post date:** [November 12, 2018, 9:02am UTC](https://discuss.elastic.co/t/error-org-postgresql-driver-not-loaded/155850/3 "2018-11-12T09:02:58Z")

</div>

I solved the problem:

First check your java version:

> ```
> root@xxxxxx:/# java -version
> openjdk version "1.8.0_181"
> 
> ```

If you are using 1.8 then you should use the JDBC42 version.  
If you are using 1.7 then you should use the JDBC41 version.  
If you are using 1.6 then you should use the JDBC43 version.

postgres setup:

postgresql-9.4-1203.jdbc42.jar

> jdbc\_driver\_library =\> '/path\_to\_jar/postgresql-9.4-1203.jdbc42.jar'  
> jdbc\_driver\_class =\> 'org.postgresql.Driver'

---

<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:** [December 10, 2018, 9:15am UTC](https://discuss.elastic.co/t/error-org-postgresql-driver-not-loaded/155850/4 "2018-12-10T09:15:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
