Solved

calling an oracle stored proc in an asp page

Posted on 2001-06-22
6
862 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:v13stories
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Accepted Solution

by:
mathavra earned 300 total points
ID: 6219242
In most cases, this is related to the client issues. Apply any latest patch you might for the client versions.

In our case, we had the same issue in two instances.

1) We were getting this error with 8.1.6 client. After applying 8.1.6.1 patch the error was gone.

2) With odbc driver version for 817 also we had the same issue. Whe  we upgraded to 81730, the problem went away.

In summary, apply any latest patch and try.
0
 

Author Comment

by:v13stories
ID: 6219284
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
0
 
LVL 3

Expert Comment

by:mathavra
ID: 6219345
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:RMZ
ID: 6221019
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
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7033807
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.
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7046123
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to take different types of Oracle backups using RMAN.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question