Link to home
Start Free TrialLog in
Avatar of v13stories
v13stories

asked on

calling an oracle stored proc in an asp page

calling a stored procedure from an ASP page through ADO. my background is in SQL, so pardon my oracle-ignorance. below is a sample of the asp we're attempting, I'm getting an error on the j.execute line, saying it's either a syntax or access violation. I'm unsure if oracle needs rights granted to the stored procedures or if I'm just using the wrong syntax.

Thanks for any help you can provide!
--Van

asp code below:

Dim j, c, r'*********************************************stored procedure section begins
Set c = Server.CreateObject("ADODB.Connection")
c.ConnectionTimeout = Application("Scheduler_ConnectionTimeout") 'looking for Scheduler
c.CommandTimeout = Application("Scheduler_CommandTimeout")
c.Open Application("Scheduler_ConnectionString")
Set j = Server.CreateObject ("ADODB.Command")
Set r = Server.CreateObject ("ADODB.Recordset")
Set r.ActiveConnection = c
Set j.ActiveConnection = c

j.CommandType = adCmdStoredProc
j.CommandText = "bbq"
' Add the Return Value Parameter
j.Parameters.Append j.CreateParameter("return", adInteger, adParamReturnValue )

'Add the Input Values
j.Parameters.Append j.CreateParameter("res_id", adInteger, adParamInput )
j.Parameters.Append j.CreateParameter("start", adDBTimeStamp, adParamInput )
j.Parameters.Append j.CreateParameter("end", adDBTimeStamp, adParamInput )
j.Parameters.Append j.CreateParameter("off", adInteger, adParamInput )


'Add the output parameter
j.Parameters.Append j.CreateParameter("start1", adDBTimeStamp, adParamOutput )
j.Parameters.Append j.CreateParameter("end1", adDBTimeStamp, adParamOutput )
j.Parameters.Append j.CreateParameter("result", adInteger, adParamOutput )

'Add Values to Input Params
j("res_id") = resource_id 'sets resource id value for the stored procedure
j("start") = date_desired.value&" "&start_time_desired 'sets start time value for the stored procedure
'j("end") = OracleDateTime(date_desired.value&" "&end_time_desired) 'sets end time value for the stored procedure
j("end") = date_desired.value&" "&end_time_desired
j("off") = offsetion 'sets offset value for the stored procedure
j("start1") = null 'this null value is for a output parameter from the stored procedure
j("end1") = null 'this null value is for a output parameter from the stored procedure
j("result") = NULL 'this null value is for a output parameter from the stored procedure
j.Execute
ASKER CERTIFIED SOLUTION
Avatar of mathavra
mathavra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of v13stories
v13stories

ASKER

do you have a url where i can get the latest odbc driver? i've heard conflicting reviews on the oracle vs. microsoft odbc drivers for oracle.
thanks,
--v
I was able to download it without log on to OTN.

From Oracle:

http://otn.oracle.com/software/utilities/software_index.htm

I have heard the same conflicting reviews about Oracle VS Microsoft ODBC drivers too. In our environment, Oracle ODBC drivers work OK.

Also, I have heard from my friends that, they try both the ODBC drivers and choose which ever works better.  

-Mathav
hi
first chk for your odbc and try connect to oracle from visual basic or delphi to chk odbc is run or not
u can call a stord procedure from any browser
all u do make connect to database then call a stord procedure.
the connection may be using odbc or jdbc
this is different from asp and jsp and ....
i have an example for connect to oracle and call a stord procedure using asp. if u want i'll send it
to u ---
in your asp file
    set cn = server.CreateObject("ADODB.Connection")
    cn.Open "DSN=a2zdb"  /*rem odbc name*/
    cn.Execute "SessionOnEnd ('"& session("uid")
&"','"&  session("pw") &"')"
    cn.close

here stored procedure named SessionOnEnd and has two parameter session("uid") ,session("pw")
first u make odbc to connect to database name a2zdb,
to execute storded procedure use the command
but u must create procedure in database using
create or replace procedure proc_name
Please update and finalize this old, open question. Please:

1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.

EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.

Thanks to all,
Moondancer - EE Moderator

P.S.  Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
Force accepted

** Mindphaser - Community Support Moderator **