# JDBC\_Static filter is not mapping the data from postgresql

**URL:** <https://discuss.elastic.co/t/jdbc-static-filter-is-not-mapping-the-data-from-postgresql/228710>\
**Category:** Logstash\
**Created:** [April 19, 2020, 8:20am UTC](https://discuss.elastic.co/t/jdbc-static-filter-is-not-mapping-the-data-from-postgresql/228710 "2020-04-19T08:20:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjilinga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anjilinga/32/86010_2.png) [@anjilinga](https://discuss.elastic.co/u/anjilinga)\
**Post date:** [April 19, 2020, 8:20am UTC](https://discuss.elastic.co/t/jdbc-static-filter-is-not-mapping-the-data-from-postgresql/228710/1 "2020-04-19T08:20:27Z")

</div>

I have loded lookup table in postgresql and used jdbc\_static filter to enrich the data. while executing i am getting the below error. In staging directory the data is not loaded.  
Can some one please help what is the issue.

Exception when executing Jdbc query {:lookup\_id=\>"local-servers", :exception=\>"Java::JavaSql::SQLSyntaxErrorException: Syntax error: Encountered ":" at line 1, column 57.", :backtrace=\>["org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(org/apache/derby/impl/jdbc/SQLExceptionFactory)", "org.apache.derby.impl.jdbc.Util.generateCsSQLException(org/apache/derby/impl/jdbc/Util)", "org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(org/apache/derby/impl/jdbc/TransactionResourceImpl)", "org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(org/apache/derby/impl/jdbc/TransactionResourceImpl)", "org.apache.derby.impl.jdbc.EmbedConnection.handleException(org/apache/derby/impl/jdbc/EmbedConnection)", "org.apache.derby.impl.jdbc.ConnectionChild.handleException(org/apache/derby/impl/jdbc/ConnectionChild)", "org.apache.derby.impl.jdbc.EmbedStatement.execute(org/apache/derby/impl/jdbc/EmbedStatement)", "org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(org/apache/derby/impl/jdbc/EmbedStatement)"]}

Mu logstash config file is

input {  
file {  
path =\> "C:/Users/605824803/Documents/data/invcs.csv"  
start\_position =\> "beginning"  
sincedb\_path =\> "C:/Users/605824803/Documents/data/null26"

```
}

```

}  
filter {  
csv{  
separator =\> ","  
columns =\> ["host\_ip","destin"]  
skip\_empty\_columns =\> false  
}  
jdbc\_static {  
loaders =\> [  
{  
id =\> "remote-users"  
query =\> "select host\_ip, host\_name from host\_mapping"  
local\_table =\> "users"  
}  
]  
local\_db\_objects =\> [  
{  
name =\> "users"  
index\_columns =\> ["host\_ip"]  
columns =\> [  
["host\_ip", "varchar(50)"],  
["host\_name", "varchar(50)"]  
]  
}  
]  
local\_lookups =\> [  
{  
id =\> "local-servers"  
query =\> "SELECT host\_name as HostName FROM users WHERE host\_ip = :host\_ip"  
target =\> "user"  
}  
]  
staging\_directory =\> "C:/Users/605824803/Documents/data/postgresdata"  
jdbc\_user =\> "postgres"  
jdbc\_password =\> "anji"   
jdbc\_driver\_class =\> "org.postgresql.Driver"  
jdbc\_driver\_library =\> "C:/Users/605824803/Downloads/postgresql-42.2.12.jar"  
jdbc\_connection\_string =\> "jdbc:postgresql://localhost:5432/Monitoring"  
}  
}  
output {  
elasticsearch {  
hosts =\> "[http://localhost:9200](http://localhost:9200)"  
manage\_template =\> false  
index =\> "test-host6"

}  
#stdout {codec =\> "rubydebug"}  
}

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 19, 2020, 3:00pm UTC](https://discuss.elastic.co/t/jdbc-static-filter-is-not-mapping-the-data-from-postgresql/228710/2 "2020-04-19T15:00:12Z")

</div>

> [@anjilinga](#):
>
> query =\> "SELECT host\_name as HostName FROM users WHERE host\_ip = :host\_ip"

You need to define the host\_ip parameter, otherwise it does not get substituted and the jdbc driver chokes on it.

---

<div class="post-metadata">

**Author:** ![anjilinga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anjilinga/32/86010_2.png) [@anjilinga](https://discuss.elastic.co/u/anjilinga)\
**Post date:** [April 19, 2020, 7:29pm UTC](https://discuss.elastic.co/t/jdbc-static-filter-is-not-mapping-the-data-from-postgresql/228710/3 "2020-04-19T19:29:08Z")

</div>

Hi Badger,

Thanks for the help. it is working now.

---

<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:** [May 17, 2020, 7:29pm UTC](https://discuss.elastic.co/t/jdbc-static-filter-is-not-mapping-the-data-from-postgresql/228710/4 "2020-05-17T19:29:26Z")

</div>

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