?
Solved

How to ping a URL from PL/SQL?

Posted on 2003-02-24
7
Medium Priority
?
3,570 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
[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
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

801 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