0

I am using jdbc_static plugin with a simple select query

jdbc_static{
        id => "JDBC_STATIC_APPLICATION_MIND_MAPPING"
        loaders => [
        {
            id => "REMOTE_MAPPING"
            query => "select field1, field2 FROM DB.view"
            local_table => "LOCAL__MAPPING_COLUMNS"
        }
        ]
...

        jdbc_user => "USR"
        jdbc_password => "PW"
        jdbc_connection_string => "jdbc:teradata://SCH/database=DB"
        jdbc_driver_class => "com.teradata.jdbc.TeraDriver"

...

I get the data from a Teradat DB, but the count query excuted by the package is causing me an issue,

The error:

[2022-09-12T11:45:36,171+02:00][ERROR][logstash.filters.jdbc.readonlydatabase] Exception occurred when executing loader Jdbc query count {:exception=>"Java::JavaSql::SQLException: [Teradata Database] [TeraJDBC 16.00.00.23] [Error 3706] [SQLState 42000] Syntax error: expected something between the word 'T1' and the 'LIMIT' keyword.", :backtrace=>["com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDatabaseSQLException(com/teradata/jdbc/jdbc_4/util/ErrorFactory.java:309)", "com.teradata.jdbc.jdbc_4.statemachine.ReceiveInitSubState.action(com/teradata/jdbc/jdbc_4/statemachine/ReceiveInitSubState.java:103)", "com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.subStateMachine(com/teradata/jdbc/jdbc_4/statemachine/StatementReceiveState.java:311)", "com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.action(com/teradata/jdbc/jdbc_4/statemachine/StatementReceiveState.java:200)"

my logstash version is 6.5.4

Do you have a solution for that issue?

C.Mahfoud
  • 90
  • 2
  • 9
  • As the error message implies, LIMIT is not valid syntax, but Teradata supports TOP instead. Don't know how to fix this in logstash. – dnoeth Sep 12 '22 at 11:37
  • Yes, that's the problem, there is no way to cutomize this count query, I found this issue open for years. https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/29 – C.Mahfoud Sep 12 '22 at 11:59
  • And for a COUNT(*) with no GROUP BY columns in the result, LIMIT 1 or TOP 1 is not needed anyway – Fred Sep 12 '22 at 14:21
  • Btw, if the count query is run to know about the number of rows return by this Select, it's not needed in Teradata, which creates the full answer set before returning it: In the initial message returned to the client there's info about how many rows will be returned. – dnoeth Sep 12 '22 at 16:05
  • I am really surprised how a package widely used like this one is not maintained as it should be ! – C.Mahfoud Sep 14 '22 at 15:16

0 Answers0