AnsweredAssumed Answered

JDBC Timestamp Insert Issues

Question asked by JamesEly on Nov 17, 2014
Latest reply on Dec 15, 2014 by IwaoAVE!

Title

JDBC Timestamp Insert Issues

Your post

Hello Everyone,

This is my first post into this forum. I've been tasked with writing a small Java program that inserts records into a FM 13 database server and I'm stumped with getting the correct format for a timestamp type field. I've scoured the internet and read the ODBC/JDBC Developer's Guide, yet everything I try gives me an error. I am hoping someone can see what I'm missing and point me in the right direction. Here's the details so far.

I'm testing in Eclipse in debug mode currently. My version of JRE is JDK 1.8.0_20 and I am running the FM13.0v2_xDBC driver for Java.

When I insert a record into the database, I've tried the following in the VALUES ( ) portion of the query, and none of them have worked:

'firstval', TIMESTAMP 'YYYY-MM-DD HH:mm:ss', 'nextval'
'firstval', {ts 'YYYY-MM-DD HH:mm:ss'}, 'nextval'
'firstval', {ts 'YYYY-MM-DD HH:mm:ss.SSSS'}, 'nextval'
'firstval', {ts'YYYY-MM-DD HH:mm:ss'}, 'nextval' // No space between ts and '
'firstval', {ts'YYYY-MM-DD HH:mm:ss.SSSS'}, 'nextval' // No space between ts and '

I've tried without seconds on the datetime, with seconds and milliseconds, etc. nothing works. The format in the field itself when viewed in Filemaker Pro is MM/DD/YYYY HH:mm:ss TZ.

Every attempt to insert yields the following error stack:

com.filemaker.jdbc.FMSQLException: [FileMaker][FileMaker JDBC] FQL0001/(1:56): There is an error in the syntax of the query.
    at com.filemaker.jdbc.FM_API.getColumnDefinitions(Unknown Source)
    at com.filemaker.jdbc.FM_API.execDirect(Unknown Source)
    at com.filemaker.jdbc.FM_API.execDirect(Unknown Source)
    at com.filemaker.jdbc1.CommonJ1Statement.execDirect(Unknown Source)
    at com.filemaker.jdbc1.CommonJ1Statement.executeUpdate(Unknown Source)
    at com.filemaker.jdbc1.CommonJ1Statement.executeUpdate(Unknown Source)
    at com.marvel.FM13Import.DBInterface.insertRecord(DBInterface.java:50)
    at com.marvel.FM13Import.FM13Import.main(FM13Import.java:167)

The query is built as a string that is passed to the DBInterface class and executed as an executeUpdate because I am not reading any content back. It's pure inserts. I am not doing transactional SQL statement prepares.

Please help. I can provide any other information needed but I am stumped as to why this isn't working for me.

Thanks

 

 

 

 

Outcomes