Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL: cURL calls::

Posted on 2013-06-20
7
Medium Priority
?
2,943 Views
Last Modified: 2013-06-20
Hello team,

Is it possible to call cURL http/s calls from within sql server 2008 using TSQL?
> are there prerequisites and what are those
>do I need to install PHP or some client / modules/etc in order to run the curl command line statements
>what are pros and cons of using

One of our third parties have provided us with the API routines but before I start my questionings them wanted to get an idea from you guys first and see what you think.
thx

JohnE
0
Comment
Question by:John Esraelo
  • 3
  • 2
  • 2
7 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39263515
While PHP has cURL builtin, there is also a command line version of cURL that you can install on your machine.  http://curl.haxx.se/  You do have to have one of them installed.  PHP requires a web server while cURL runs from the command line.  Come to think of it, you can run PHP from the command line too if you want to.

If you can run 'system' or 'exec' commands from TSQL, then you should be able to run either of those programs.
0
 
LVL 12

Expert Comment

by:Richard Davis
ID: 39263524
I'm sorry for sounding abrasive, but applications are responsible for communication between data stores...not the data stores themselves.

So, if your third party has provided you with an API, then they are expecting that you will create or have a supporting application in place that will provide the desired calls out to the remote service.

~AB
0
 

Author Comment

by:John Esraelo
ID: 39263921
Adrian,
sql server can actually make an xp_cmdshell execution if I am not mistaken.  However, I am not sure about the rest of it and that is something that I would probably need to communicate with them, but, here today, I wanted to get a general thoughts here and collect knowledge.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:John Esraelo
ID: 39263926
Dave,

I believe you are on the money.  I have tried something and did work in tsql. However, for some reason I am getting auth failure and working on that right now .
0
 

Author Closing Comment

by:John Esraelo
ID: 39263931
Thank you Dave.
0
 
LVL 12

Expert Comment

by:Richard Davis
ID: 39263987
The only reason I stated what I did, was because database servers should be strictly just that. In a proper n-tier architecture, database servers should never take on the load of handling cross domain communications. Not even intra-domain communications, except in very limited circumstances.

The application layer is wholly responsible for all aspects of data transportation. Just because a database server supports that functionality certainly does not justify breaking best-practices in favor of using it.

I can understand SQL Server's ability to ACCEPT remote calls as the end result is a formatted dataset, but to make outgoing calls just totally goes against the grain of the intended design of a database server.

I wish you luck if this setup is to be used in any level of enterprise capacity.

~AB
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39264099
I tend to agree with Adrian.  Although it is doable, I don't think it is a particularly good idea and I would always use cURL from my application, not my database.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

877 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