Solved

calling an oracle stored proc in an asp page

Posted on 2001-06-22
6
849 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

919 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now