Thursday, November 3, 2011

Passing User credentials for Web Proxy server in UTL_HTTP

All most all corporates uses Web proxy server to allow their employees to access internet. This way they have great control on who gets to see what site etc. When you try to access a web page using IE it doesn't ask for the network user id and password however Firefox and Safari may ask for the same to send it over to the Proxy server.
UTL_HTTP helps us to consume web resources through PL SQL, it can as well accept Web Proxy Server to connect to the internet. However you will get an access denied error message if your Proxy Server requires user authentication.
You can overcome this by allowing HTTP requests from Database server in your Web Proxy server or by simply passing your user credentials while specifying the Proxy server in UTL_HTTP request like this.


SELECT UTL_HTTP.REQUEST('http://www.google.com','http://<Your Network ID>:<Your Password>@webproxy.yourcompany.com:<Port>') from dual

PS: By default web access using UTL_HTTP access is denied in Oracle 11g onwards. You need to create an ACL to allow the traffic flow through Oracle database.

If you don't know the Web proxy server, contact your network administrator or you can find the same from Internet Explorer Tools->Internet Options->Connections->LAN Settings page. If you use automatic configuration script, type that address directly on your browser and look inside that file to locate your Proxy server.

Finally you have to pass the user credentials to the proxy server and no to the website you are browsing (I often do this mistake).

References: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e25788/u_http.htm#ARPLS71019

1 comment:

  1. I salute to the admin of this blog. I really like and I will surely recommend this blog to my friends. For your concerns solution visit this link
    access torrentHound in UK

    ReplyDelete