Solved

Connect to a domain URL from within SQL Server

Posted on 2016-08-03
3
53 Views
Last Modified: 2016-09-05
Hi,

I have a stored procedure in SQL Server that is connecting to a URL and parsing xml into tables. The URL is on a network that I can access via a VPN connection, but instead of connecting the computer to the network can you just login using SQL Server or tsql.

This is the command:

exec dbo.meteobridgeDavisVantagePro2 @url = 'http://***.***.***.***//cgi-bin/livedataxml.cgi'
      ,@http_basic_username = '****'
      ,@http_basic_password = '********'

The username and password is used to access the URL itself not the domain network too.

This is how I connect to the URL from within the stored procedure:

exec @ole_result = sp_OACreate 'MSXML2.XMLHttp', @ole_object OUT
      exec @ole_result = sp_OAMethod @ole_object, 'open', NULL, 'GET', @url, false, @http_basic_username, @http_basic_password
      exec @ole_result = sp_OAMethod @ole_object, 'send', NULL, ''
      exec @ole_result = sp_OAGetProperty @ole_object, 'status', @http_status OUT
      exec @ole_result = sp_OAGetProperty @ole_object, 'responseXML.xml', @http_response OUT
      SET @xml = @http_response

Thank you
0
Comment
Question by:crompnk
3 Comments
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 250 total points
ID: 41740337
Hi crompnk,
One option may be to set all this up in a SQL Server job with several steps
Step 1 - Powershell job step which uses New-PSDrive to connect to other domain
Step 2 - T-SQL job step which calls your dbo.meteobridgeDavisVantagePro2 stored procedure
0
 
LVL 6

Assisted Solution

by:Manju
Manju earned 250 total points
ID: 41740911
With JDBC, you can. Please refer to Microsoft site(https://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx) to play with url's
0
 

Author Closing Comment

by:crompnk
ID: 41784352
I actually solved this by just adding external access to the URL, this was easier than trying to control access within SQL Server.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now