Splunk Search

java.sql.SQLException: Incorrect syntax near '11'

Cuyose
Builder

I seem to be getting this trying to use the jdbc driverfor SQL whenever I try to run the run.sh

2012-11-13 11:37:04,097 0 [main] ERROR com.splunk.jdbcscriptedinput.Main - java.sql.SQLException: Incorrect syntax near '11'.

query.properties.mssql are below

connectionString=jdbc:sqlserver://172.17.56.215;databaseName=Errors;
username=sa
password=XYZ

driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
iteratorField=ERROR_TIME
query=select CATEGORY,ERROR_TIME,APPLICATION from Errors where ERROR_TIME>${ERROR_TIME} order by Errors.ERROR_TIME
dateField=ERROR_TIME

extra=instance=FOO

Tags (1)
0 Karma

Cuyose
Builder

I figured it out, I wasn't returning an integer in the Error_time field so had to modify the query to
query=select CATEGORY,ERROR_TIME,APPLICATION from Errors where Errors.ERROR_TIME>'${ERROR_TIME}' order by Errors.ERROR_TIME

0 Karma

Cuyose
Builder

I still seem to be having an issue in that the query pointer can't parse a datetime format from the database. When it tries to update the query.pointer with a value of '2012-11-13 15:17:05.817' it truncates it to 2012-11-13 15:17:05.8 and the next run results in a null pointer exception. This ends up re-indexing all duplicate data every run as it can't update this field.

0 Karma
Get Updates on the Splunk Community!

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...