Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems with UTL_HTTP and network access problems

Brent HarlowOct 1 2013 — edited Oct 4 2013

I have a similar problem to what has been listed on the following thread

https://forums.oracle.com/thread/2454508

But have been unable to come to any solution so need some more help !!

I have this all working fine from my local laptop but am not able to get it working from our test server (behind a layer 7 switch)

-- Testing for google.com

BEGIN

  DBMS_NETWORK_ACL_ADMIN.create_acl (

    acl          => 'google.xml',

    description  => 'Google ACL Control List',

    principal    => 'TEST_USER',

    is_grant     => TRUE,

    privilege    => 'connect');

/

BEGIN

  DBMS_NETWORK_ACL_ADMIN.assign_acl (

    acl         => 'google.xml',

    host        => 'google.com');

END;

/

  COMMIT;

END;

/

Running the following as TEST_USER

SQL> select utl_http.request('google.com') from dual             

                                                                 

   1 select utl_http.request('google.com') from dual             

            *                                                    

ORA-29273: HTTP request failed                                   

ORA-06512: at "SYS.UTL_HTTP", line 1722                          

ORA-24247: network access denied by access control list (ACL)    

ORA-06512: at line 1                                             

which suggests that ACL is the problem, but if I use tcpportping function

SQL> select tcpportping('google.com',80) from dual  

                                                    

TCPPORTPING('GOOGLE.COM',80)                        

----------------------------                        

                           0                        

                                                    

1 row selected                                      

                                                    

Elapsed time: 00:00:00.424                          

It works fine.  If I tried tcpportping with a different host ...

SQL> select tcpportping('google.co.uk',80) from dual          

                                                              

   1 select tcpportping('google.co.uk',80) from dual          

            *                                                 

ORA-29260: network error: not connected                       

ORA-06512: at "SYS.UTL_TCP", line 212                         

ORA-06512: at "SYS.UTL_TCP", line 432                         

ORA-06512: at "TEST_USER.TCPPORTPING", line 47           

ORA-24247: network access denied by access control list (ACL) 

ORA-06512: at line 1               

                         

which suggests to me that ACL is not the real issue for "select utl_http.request('google.com') from dual" as tcpportping does not report an ACL issue but it (expectedly) does for a different host.

I can perform nslookup from DB o/s user

[oracle@test2 ~]$ nslookup google.com

Server:         8.8.8.8

Address:        8.8.8.8#53

Non-authoritative answer:

Name:   google.com

Address: 173.194.34.98

Name:   google.com

Address: 173.194.34.100

Name:   google.com

Address: 173.194.34.102

Name:   google.com

Address: 173.194.34.99

Name:   google.com

Address: 173.194.34.97

Name:   google.com

Address: 173.194.34.103

Name:   google.com

Address: 173.194.34.104

Name:   google.com

Address: 173.194.34.96

Name:   google.com

Address: 173.194.34.101

Name:   google.com

Address: 173.194.34.110

Name:   google.com

Address: 173.194.34.105

and telnet ok

[oracle@test2 ~]$ telnet google.com 80

Trying 173.194.34.103...

Connected to google.com (173.194.34.103).

Escape character is '^]'.

GET / HTTP/1.0

HTTP/1.0 302 Found

Location: http://www.google.co.uk/?gws_rd=cr&ei=aKlKUvKDH8K80QXM1oGABg

Cache-Control: private

Content-Type: text/html; charset=UTF-8

Set-Cookie: PREF=ID=636a9a715d3e713a:FF=0:TM=1380624744:LM=1380624744:S=UmAm64le9UZRtDQE; expires=Thu, 01-Oct-2015 10:52:24 GMT; path=/; domain=.google.com

Set-Cookie: NID=67=vydxBJQUOyjK20AY5G_h7yd23MWHY9L1dxCNRTnkwaVilDsEdMViDB9bbkecMILO7U9SBpTQqGpwBR9y0pL1qcdj0Mx_Rdh_Gu0D3KiunmSIV1nrRdV4Q3T3Y4MKDFLz; expires=Wed, 02-Apr-2014 10:52:24 GMT; path=/; domain=.google.com; HttpOnly

P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."

Date: Tue, 01 Oct 2013 10:52:24 GMT

Server: gws

Content-Length: 261

X-XSS-Protection: 1; mode=block

X-Frame-Options: SAMEORIGIN

Alternate-Protocol: 80:quic

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">

<TITLE>302 Moved</TITLE></HEAD><BODY>

<H1>302 Moved</H1>

The document has moved

<A HREF="http://www.google.co.uk/?gws_rd=cr&ei=aKlKUvKDH8K80QXM1oGABg">here</A>.

</BODY></HTML>

Connection closed by foreign host.

[oracle@test2 ~]$

So ping/nslookup/telnet from DB o/s user is ok - UTL_TCP (using TcpPortPing function) is ok - but UTL_HTTP returns ACL errors ?

Help please ?!

ps - If i run utl_http as SYS user it also fails

SQL> Session [1] SYS@ORACLE_TEST                   

SQL> select utl_http.request('google.com') from dual   

                                                       

   1 select utl_http.request('google.com') from dual   

            *                                          

ORA-29273: HTTP request failed                         

ORA-06512: at "SYS.UTL_HTTP", line 1722                

ORA-12543: TNS:destination host unreachable            

ORA-06512: at line 1                                   

This post has been answered by Brent Harlow on Oct 3 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2013
Added on Oct 1 2013
22 comments
33,221 views