How to use Proxy Server in SQL Web call


We have the following SQL (Extract of sql):

        exec @result=sp_oacreate 'msxml2.serverxmlhttp',@error out 
        if @result <> 0 exec sp_oageterrorinfo @error 

        --Get the data
        exec @result=sp_oamethod @error, 'open',null,'GET',@url,'false' 
        if @result <> 0 exec sp_oageterrorinfo @error 
        exec @result=sp_oamethod @error,'send' 
        if @result <> 0 exec sp_oageterrorinfo @error 

Where @url is a webpage. This code extract above works with no issue. We now have a proxy server in place with IP address which has port 80 opened.

My query is how can I ass this proxt server address into the above code so that when the request is made it goes through the proxy server?

Any help / guidance is appreciated.


never used the sp_ and never will, it seems so odd to call http from withing sql but have you looked at this

EXEC sp_OAMethod @Request, 'setProxy', NULL, '2', 'http://'

Hello Yosiasz,

Thank you for this. This worked perfectly.
I was using the statement you suggested however I was not using the NULL parameter so it would not work.

Your help is appreciated thanks again

thank Google! :joy: