# Does not return data from the database

**URL:** <https://discuss.elastic.co/t/does-not-return-data-from-the-database/231036>\
**Category:** Logstash\
**Created:** [May 4, 2020, 8:56pm UTC](https://discuss.elastic.co/t/does-not-return-data-from-the-database/231036 "2020-05-04T20:56:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FernandoMOTA](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@FernandoMOTA](https://discuss.elastic.co/u/FernandoMOTA)\
**Post date:** [May 4, 2020, 8:56pm UTC](https://discuss.elastic.co/t/does-not-return-data-from-the-database/231036/1 "2020-05-04T20:56:48Z")

</div>

I can't get Elastic to return the data received from my DB, no data is returned, below is the configuration file:

> input {
> 
> jdbc {
> 
> ```
> jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> 
> jdbc_connection_string => "jdbc:sqlserver://ELASTICSERVER\SQLEXPRESS:1433;databasename=Super_Loja_Elastic;integratedSecurity=false;" 
> 
> jdbc_driver_library => "" 
> 
> jdbc_paging_enabled => true
> 
> tracking_column => "unix_ts_in_secs"
> 
> use_column_value => true
> 
> tracking_column_type => "numeric"
> 
> schedule => "*/5 * * * * *"
> 
> jdbc_user => "USER" 
> 
> jdbc_password => "PASSWORD" 
> 
> statement =>"SELECT *,DATEDIFF (SECOND, '1970-01-01', modification_time) AS unix_ts_in_secs FROM superloja WHERE DATEDIFF (SECOND, '1970-01-01',modification_time) > :sql_last_value AND :sql_last_value < DATEDIFF (SECOND, '1970-01-01',CURRENT_TIMESTAMP)"
> 
> ```
> 
> }
> 
> }
> 
> output {
> 
> elasticsearch {
> 
> ```
> hosts => ["localhost:9200"]
> 
> index => "PRINCIPAL_Super_Loja" 
> 
> ```
> 
> }
> 
> }

---

<div class="post-metadata">

**Author:** ![ropc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ropc/32/47022_2.png) [@ropc](https://discuss.elastic.co/u/ropc)\
**Post date:** [May 6, 2020, 9:39am UTC](https://discuss.elastic.co/t/does-not-return-data-from-the-database/231036/2 "2020-05-06T09:39:57Z")

</div>

Hi @FernandoMOTA

1. Do not forget to use the `Preformatted text` when sharing configuration details or logs messages.

 ![Screenshot 2020-05-06 at 5.31.41 PM](https://us1.discourse-cdn.com/elastic/original/3X/4/2/42ea0dfbb150d2d5d96ce26bd73b513c22aa2a47.png)

1. I see that you did not specify any value in the `jdbc_driver_library` [setting](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#plugins-inputs-jdbc-jdbc_driver_library). Did you place the corresponding JAR file in the Logstash Java classpath?

2. Have you tried to run this SQL statement directly against your DB and check if it returns any results? (replacing `sql_last_value` with a test value).

3. You could try to run Logstash with debug logging enabled to check for potential errors. For example, from the [command line](https://www.elastic.co/guide/en/logstash/current/running-logstash-command-line.html#command-line-flags):

- `bin/logstash --debug -f mypipeline.conf`

Feel free to share these debug logs with us (scrub any sensitive data).

Thank you.

---

<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:** [June 3, 2020, 9:44am UTC](https://discuss.elastic.co/t/does-not-return-data-from-the-database/231036/3 "2020-06-03T09:44:48Z")

</div>

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