tags:

views:

384

answers:

2

I successfully executed a stored procedure on a SQL2005.When I wanted to populate the results in a form via CFSTOREDPROC , I am getting the following error.

    [Macromedia][SQLServer JDBC Driver][SQLServer]EXECUTE permission denied on object 'GetPSRreportStock', database 'CGTSP_GET',

  <cfstoredproc procedure="FP_Get..GetStartStopTotalBalesCott" datasource="#TS#" username="#UNT#" password="#SPW#">

      <cfprocparam  type="in" cfsqltype="CF_SQL_INTEGER" dbvarname="@reportYear"  value="#xxMDB#">
        <cfprocparam  type="in" cfsqltype="CF_SQL_INTEGER" dbvarname="@orderMonth"     value="#xxOBDB#">
        **<cfprocresult name="ccDPR">**
    </cfstoredproc>

The CF code is in MX-6. How to correct the error?

+2  A: 

I think it's because you need to give the user your web server is running as EXECUTE permissions for that stored procedure (in the SQL Server management console).

Mark B
+4  A: 

Check to make sure the user trying to run the stored proc has execute permissions, you can do this in SQL Server Management Studio by going to the Database -> Programmability -> and Right Click on the Stored Proc and select 'Properites', then go to the 'Permissions' section and see if your user is there, if its not, you can add the user and give it EXECUTE permissions, or you can do the following in a new query:

GRANT EXECUTE TO <username> ON <stored proc name>
Scott Lance
I have added my name to grant the Execute permissions in SQL server management console.Still the same error.
vas
Use the name that is in the username field in your code:<cfstoredproc procedure="FP_Get..GetStartStopTotalBalesCott" datasource="#TS#" username="#UNT#" password="#SPW#">That is the user that is trying to execute the proc on the database server.
Scott Lance
Thanks a million ! It worked I changed the Pswd/Logn in the CF Application file , to match the current SQL Pswd/Logn and it worked.Now got a Q.....how to deal with the same issue , if it crops up on Production... I mean improper Pswd/Logn matching vis a vis CF Application file and SQL server?
vas
For our apps, we usually have a couple of different application accounts that access our database. You can simply create a dedicated application account on your database server server (under the Security->Logins folder for the database server), then give it data reader/writer permissions on your application databases (Under the Security -> Users folder on your database), then give that account execute permissions on the stored procs it needs to use on that database.
Scott Lance