?
Solved

How to ping a URL from PL/SQL?

Posted on 2003-02-24
7
Medium Priority
?
3,864 Views
Last Modified: 2013-12-12
I know utl_http can be used to call a URL.
I need to write a stored function to ping
a URL with a timeout:

   ping(varchar2 URL, number timeOut) return number;

The stored function should return 1 if it succeeds;
and return 0 if it fails to ping the URL within
the timeout period.  I coulnd't figure out a
good way to write this function from the information
I can find.  

I'd appreciate any help, espeicially from people
who have written similar functions.  Thanks a lot!

Henry J.
0
Comment
Question by:tank209
7 Comments
 
LVL 8

Expert Comment

by:Danielzt
ID: 8019029

Try it:

http://www.csee.umbc.edu/help/oracle8/server.815/a68001/utl_http.htm

Create or replace funciton
ping(varchar2 URL, number timeOut)
return number;
as
begin

SELECT utl_http.request(URL) FROM dual;
return 1;

exception
 when INIT_FAILED or REQUEST_FAILED then
   return 0;
end
0
 

Expert Comment

by:yhwu
ID: 8024184
how about call os command?
0
 
LVL 8

Expert Comment

by:Danielzt
ID: 8028287
Sorry. I looks we can not use OS command in PL/SQL.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:tank209
ID: 8038823

I mentioned in my question that I knew utl_http
is what I should use.  But it is not trivial
to make sure all exceptions are trapped and
timeout can be set, the way ping would normally
work.  I wonder if there is any well-tested
PL/SQL function allowing me to do just that.
0
 
LVL 4

Expert Comment

by:bmoshier
ID: 8338515
Yes, you can call OS commands from PL/SQL.  You can do this from a C or Java external function.

Would pinging the host be enough?

Bertram Moshier
Oracle Certified Professional 8i and 9i DBA

http://www.bmoshier.net/bertram
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 10152799
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Henka
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 10214520
PAQed, with points refunded (200)

Computer101
E-E Admin
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
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.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses

578 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