Sqlserver call http Request

Source: Internet
Author: User
First, enable sp_configureshowadvancedoptions, 1; GORECONFIGURE; GOsp_configureOleAutomationProcedures, 1; GORECONFIGURE; GOEXECsp_configureOleAutomationProcedures; GO and then write the stored procedure: CREATEPROCEDU

First, enable sp_configure 'show advanced options', 1; go reconfigure; GO sp_configure 'ole Automation Procedures ', 1; go reconfigure; go exec sp_configure 'ole Automation Procedures '; GO then writes the stored procedure: CREATE PROCEDU

First:

Enable extended stored procedure Permissions
Sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
Sp_configure 'ole Automation Procedures ', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'ole Automation Procedures ';
GO

Then write the stored procedure:

Create procedure [dbo]. [SP_HTTP]
@ Parametro varchar (10) = NULL
AS
DECLARE @ obj INT
DECLARE @ sUrl varchar (200)
DECLARE @ response INT

SET @ sUrl = 'HTTP: // localhost/test/test.html? Id = '+ @ Parametro

EXEC sp_OACreate 'msxml2. serverxmlhttp', @ obj OUT
EXEC sp_OAMethod @ obj, 'open', NULL, 'get', @ sUrl, false
EXEC sp_OAMethod @ obj, 'send'
EXEC sp_OAGetProperty @ obj, 'responsetext ', @ response OUT

SELECT @ response [response]
EXEC sp_OADestroy @ obj
RETURN


Access httpRequestExtended Stored Procedure required

However, we can see that using the extended storage process is dangerous on the Internet.

What security measures should be taken?

I have not studied much. After all, sqlserver is just a play.

You probably need to assign permissions. These extended functions are public by default.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.