I get the following error when attempting to use a column value or when using the default timestamp:
Java::ComMicrosoftSqlserverJdbc::SQLServerException: Incorrect syntax near ':'.: SELECT * from table where id > :sql_last_start {:level=>:error}
Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComMicrosoftSqlserverJdbc::SQLServerException: Incorrect syntax near ':'.>, :level=>:warn}
config file:
input {
jdbc {
type => "cxusermetric"
jdbc_driver_library => "/app/logstash/sqljdbc_4.2/sqljdbc41.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => ""
jdbc_user => ""
jdbc_password => ""
statement => "SELECT * from table where id > :sql_last_start"
use_column_value => true
tracking_column => id
}
}
Doesn't SQL Server use ? as the placeholder for parameters? Also, for logstash-input-jdbc 3.0.0 the parameter is named sql_last_value, not sql_last_start.
Java::ComMicrosoftSqlserverJdbc::SQLServerException: Incorrect syntax near '?'.: SELECT * from table where id > ?sql_last_value {:level=>:error}
Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComMicrosoftSqlserverJdbc::SQLServerException: Incorrect syntax near '?'.>, :level=>:warn}
I meant SELECT * from table where id > ?. AFAICT that's the syntax for a parameterized query in SQL Server. Maybe named parameters are supported via some other mechanism. The the SQL Server documentation.
Sorry for the delayed response, but changing the parameter to sql_last_value (from sql_last_start) fixed the problem. The placeholder for sql server was correct.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.