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

Executing the SQL statement is not allowed - Error

Community Beginner ,
Mar 03, 2010 Mar 03, 2010

Copy link to clipboard

Copied


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

Views

5.9K

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Documentation