MindCrafter
07-04-2004, 03:47 AM
Okay all,
I have a web page which uses a stored procedure to insert form data into a SQL 2000 Db. The StoredProc uses a ColdFusion DSN.
Code Snippet:
Code:
<cftry>
<cfstoredproc debug="no"
procedure="::SP_Name::"
returncode="yes"
datasource="::DSN Name::"
username="::CFM Logon Id::"
password="::Password::">
<cfprocparam cfsqltype="cf_sql_varchar" type="in" value="#FORM.txtFName#" dbvarname="@FNAME">
<cfprocparam cfsqltype="cf_sql_varchar" type="in" value="#FORM.txtLName#" dbvarname="@LNAME">
<cfprocparam cfsqltype="cf_sql_varchar" type="in" value="#FORM.txtEmail#" dbvarname="@@EMAIL">
<!--- Rest of the input Params --->
<cfprocparam cfsqltype="cf_sql_integer" type="Out" variable="NewPIN" dbvarname="@NewPIN">
<cfprocresult name="rsInsertData" resultset="1">
</cfstoredproc>
<cfcatch type="database">
<cfif cfcatch.Detail neq "">
<cfset NewPIN=0>
<!-- Code to handle error and send error message to end user --->
</cfif>
</cfcatch>
</cftry>
<cfif NewPIN neq 0>
<!-- Code that completes processing the form data and displays confirmation message to end user -->
</cfif>
When I run the code on my development server I have no problems. After I upload the page to the ISP's web server the below error is returned.
Code:
Catch Stmts Returned Values
cfcatch.Type Database
cfcatch.NativeErrorCode 2812
cfcatch.Detail [Macromedia][SQLServer JDBC Driver][SQLServer]Could not find stored procedure 'spAddUserAccount'.
cfcatch.Message Error Executing Database Query.
cfcatch.SQLState HY000
If I run the code using the default SQL user account the ISP set up which is also the DB Owner, the code works. As it is very dangerous to use any account with owner privs for any production application, I had the ISP create a second user for my Db. This second user is in both DBReader and DBWriters roles with specific permission to execute the stored procedure.
I have also had the ISP varify that the DSN used does have permission to execute Stored procedures.
As for the stored procedure, I have successfully tested it in both classic ASP and ASP.net versions of the web form using the second User account.
I'm confused as to why the error is being generated and how to resolve the issue.
MindCrafter
www.MindCrafter.com
I have a web page which uses a stored procedure to insert form data into a SQL 2000 Db. The StoredProc uses a ColdFusion DSN.
Code Snippet:
Code:
<cftry>
<cfstoredproc debug="no"
procedure="::SP_Name::"
returncode="yes"
datasource="::DSN Name::"
username="::CFM Logon Id::"
password="::Password::">
<cfprocparam cfsqltype="cf_sql_varchar" type="in" value="#FORM.txtFName#" dbvarname="@FNAME">
<cfprocparam cfsqltype="cf_sql_varchar" type="in" value="#FORM.txtLName#" dbvarname="@LNAME">
<cfprocparam cfsqltype="cf_sql_varchar" type="in" value="#FORM.txtEmail#" dbvarname="@@EMAIL">
<!--- Rest of the input Params --->
<cfprocparam cfsqltype="cf_sql_integer" type="Out" variable="NewPIN" dbvarname="@NewPIN">
<cfprocresult name="rsInsertData" resultset="1">
</cfstoredproc>
<cfcatch type="database">
<cfif cfcatch.Detail neq "">
<cfset NewPIN=0>
<!-- Code to handle error and send error message to end user --->
</cfif>
</cfcatch>
</cftry>
<cfif NewPIN neq 0>
<!-- Code that completes processing the form data and displays confirmation message to end user -->
</cfif>
When I run the code on my development server I have no problems. After I upload the page to the ISP's web server the below error is returned.
Code:
Catch Stmts Returned Values
cfcatch.Type Database
cfcatch.NativeErrorCode 2812
cfcatch.Detail [Macromedia][SQLServer JDBC Driver][SQLServer]Could not find stored procedure 'spAddUserAccount'.
cfcatch.Message Error Executing Database Query.
cfcatch.SQLState HY000
If I run the code using the default SQL user account the ISP set up which is also the DB Owner, the code works. As it is very dangerous to use any account with owner privs for any production application, I had the ISP create a second user for my Db. This second user is in both DBReader and DBWriters roles with specific permission to execute the stored procedure.
I have also had the ISP varify that the DSN used does have permission to execute Stored procedures.
As for the stored procedure, I have successfully tested it in both classic ASP and ASP.net versions of the web form using the second User account.
I'm confused as to why the error is being generated and how to resolve the issue.
MindCrafter
www.MindCrafter.com