Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Executing the SQL statement is not allowed - Error

Community Beginner ,
Mar 03, 2010 Mar 03, 2010


I am getting "Executing the SQL statement is not allowed" for an INSERT cfquery that I'm running.  I checked the usual suspects:


- DSN allows INSERT

- I've seen reports online where certain field names or values are considered key words, so for protection CF blocks the query in this way (it would be nice if there was a different error message when it gets blocked this way vs. the DSN doesn't allow INSERT error message).  The field names and values were all benign strings, so it didn't seem like that.


I took the same string for the query and ran it on another page and it ran fine (same DSN, too).

TOPICS
Database access
6.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 03, 2010 Mar 03, 2010

SOLVED: I decided to enter this in here, just to get it into web searches for others since I couldn't find anything.

- I was calling a function for one of the values in the query:  get_db_status_code("initialize")  Apparently CF parses the query to see if it's allowed BEFORE it runs the CFML in it, so something in that function name, or the parameter "initialize" was a key word that CF doesn't allow.  I moved the function call outside of the query and loaded a temp variable for use in the query and it then worked.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2014 Mar 11, 2014
LATEST

To help any searchers, please kindly mark the answer as correct.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2014 Mar 10, 2014

Since this is the first google result for this error message I thought I'd also add that you will get this error message if the Datasource explicitly disallows the type of SQL statement you're attempting to run. For example if you're attempting to run an UPDATE statement, and the UPDATE checkbox is not turned on, then you will get this error .

To find this setting, edit the DSN and click the "Show Advanced Settings" button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources