Search code examples
sqljdbcodbcfilemaker

FileMaker Pro 10 - ODBC/JDBC - Query Parse Error that doesn't make sense


I'm trying to run this simple query over a JDBC connection:

select _fk_DeptBillTo from WorkOrder

And I'm getting back this error:

 09:31:39  [SELECT - 0 row(s), 0.000 secs]  [Error Code: -201, SQL State: HY000]  [DataDirect][SequeLink JDBC Driver][ODBC Socket][DataDirect][ODBC FileMaker driver][FileMaker]Parse Error in SQL
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec  [0 successful, 0 warnings, 1 errors]

I've verified that this field exists. I've checked the spelling and case about 20 times :-(. Also I've successfully run this query replacing _fk_DeptBillTo with a different field.

I'm not sure but the common pattern so far is that I get this error when I use fields that start with an underscore.

Is there a way to quote field names, like how in MySQL you do select somefield from ...? If so would that help here?


Solution

  • I think you've answered your own question... either avoid leading underscores or quote the field names. Try either double quote " or single quote ' and see which one works.

    I ran into a similar problem with somebody who had named their field 'table' - that's a reserved word, so it was always failing.