My Rails app is connected to a remote DB2 database, and when migrating I’m stumbling into this error:
== DropLegacyProject: migrating ========================================
rake aborted!
An error has occurred, this and all later migrations canceled:
RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "LIMIT" was found following "". Expected tokens may include: "FETCH FIRST <n> ROWS ONLY". SQLSTATE=42601 SQLCODE=-104: SELECT projects.* FROM projects WHERE projects.id < 17 LIMIT 1
How can I fix this?
As bhamby suggested, DB2 does not support the
LIMIT xkeyword… by default.But starting with DB2 v9.7.2, support for
LIMIT xcan be enabled via the DB2_COMPATIBILITY_VECTOR registry variable:…and it works!