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
Solved

Connect to a domain URL from within SQL Server

Posted on 2016-08-03
3
66 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

808 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