Hi Guys
I have an ASP application that connects to an Oracle database, right now I'm trying to connect this same ASP application to a DB2 database (Express-C, version 9.5.0).
I'm in the process of trying to translate all the programing withing asp pages, so, can interact smoothly with db2.
Now, I have problems trying to use a stored procedure (db2) and call it from my asp application.
Here's part of my procedure:
-
CREATE PROCEDURE Y
-
(IN P1 VARCHAR(10), IN P2 SMALLINT, IN P3 DATE, OUT P4 CHAR)
-
Here's my asp page:
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
-
<%
-
'Establish the connection
-
'strConn = "DSN=mgs;UID=db2admin;PASSWORD=xxx"
-
strConn = "Provider=IBMDADB2.DB2COPY1; DSN=mgs; UID=MARIO GONZALEZ; PWD=marito"
-
Set Conn=Server.CreateObject("ADODB.Connection")
-
Conn.Open strConn
-
-
'Define the command object
-
Set Cmd=Server.CreateObject("ADODB.Command")
-
Cmd.ActiveConnection = Conn
-
Cmd.CommandText = "CALL Y"
-
Cmd.CommandType = 1
-
Cmd.Parameters.Refresh
-
Cmd.Properties.Refresh
-
-
'Create and append the parameters
-
Cmd.Parameters.Append Cmd.CreateParameter("P1",200,1,10)
-
Cmd.Parameters.Append Cmd.CreateParameter("P2",2,1,0)
-
Cmd.Parameters.Append Cmd.CreateParameter("P3",133,1,0)
-
-
'Set the parameter values
-
Cmd("P1")="A"
-
Cmd("P2")=1
-
Cmd("P3")="01/01/2005"
-
-
Cmd.Parameters.Append Cmd.CreateParameter("P4",200,2,1)
-
-
'Execute the "CALL" statement for the procedure. ADO 'constructs the CALL statement
-
set rs1=Cmd.Execute
-
-
'Free the recordset
-
set rs1=nothing
-
-
'Display the results
-
response.write "<HTML>"
-
response.write cmd(1)
-
response.write "<BR>"
-
response.write cmd(2)
-
response.write "</HTML>"
-
-
'Close the connection
-
Conn.Close
-
set Conn=nothing
-
%>
And here's the error on IE:
Error Type:
IBM OLE DB Provider for DB2 (0x80004005)
[DB2/NT] SQL0440N No authorized routine named "Y" of type "PROCEDURE" having compatible arguments was found. SQLSTATE=42884
/db2/test3.asp, line 30 (set rs1=Cmd.Execute)
Any thoughts?
Thanks