[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 449
  • Last Modified:

webservice vs code connection string

what is the primary difference between getting data through a webservice versus getting it through a connection string in the application code?

thanks
0
anushahanna
Asked:
anushahanna
  • 7
  • 4
  • 2
  • +2
8 Solutions
 
rg20Commented:
A web service will still use a connection string.  Web services are going to call the database, and format the data in a way that it can be transmitted to another application, which typically does not have access to the database.  

For instance, if you are calling amazon.com webservice, you will get access to only the data they want you to see, you can't get access to their gross sales.

Hope this helps.
Roger
0
 
cyberkiwiCommented:
I don't know about "primary", but my #1 use for webservices is to get around firewall issues.  Port 80 (or 443) is all you need to open, without worrying about SQL Server surface area configuration or corporate firewalls.
0
 
anushahannaAuthor Commented:
>>Web services...format the data

is it equivalent of a view- selected columns only..

>>if you are calling amazon.com webservice, you will get access to only the data they want you to see, you can't get access to their gross sales.

this is how a view will do it- restrict them from the gross sales...?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Arthur_WoodCommented:
If you connect to the database through your own code (you say 'getting it through a connection string in the application code') you can extract whatever data you might happen to want or need.  

If you make use of a web service, you can only access the data that the web service makes available, in the form that the web service makes it available.  If a method is exposed by the web service, then you can access that method, and retrieve whatever the method exposes.  But if the web service does not expose some attribute that you want, too bad, you can't get it.

Web services are predominantly used to allow one application to expose data to other applications, by exposing the web service as a means to get the exposed data.  The web service completely controls what data the other application can have access to.

AW
0
 
anushahannaAuthor Commented:
>>#1 use for webservices

if port issues were not present, would WS be still your choice?
0
 
anushahannaAuthor Commented:
>>you can extract whatever data you might happen to want or need.  

only if appropriate permissions are given to that SQL account, right?
0
 
rg20Commented:
For users who are not allowed to know anything about the database, yes webservice is the way to go.

The benefit to using them for internal applications is that you can make different front ends for your app without having to recreate the datalayer each time.  You could use the same data for a web front end and a thick client application and be assured you are going to get the same data each time.

The downfall is network traffic.
0
 
anushahannaAuthor Commented:
>>For users who are not allowed to know anything about the database, yes webservice is the way to go.

good point- thanks.

>>The downfall is network traffic.

that is true, either way, right?
0
 
rg20Commented:
No because typically there is a dataflow when you do the original query from the database.(Database server is typically not on the same server as the application serving it up)

Then there is the process of assembling the data into something that can be passed(no network traffic here)

After the data is ready to transmit, you have a call from the client, then a response that the server is ready, then the request from the client for the data, then the passing of the data.
0
 
cyberkiwiCommented:
A single HTTP request response pair is probably 600 bytes too many, and if XML is the transport, another few K's (scales by data size) wasted on using web services.

> if port issues were not present, would WS be still your choice?

Maybe, if the business tier needs to sit outside Sql server.  Web services or SQL CLR can separate business tier from front end, without fully revealing logic in SQL functions and procedures.
0
 
anushahannaAuthor Commented:
rg20, so what i understand you are saying is, with a DB call, it goes from DB box to App box to Client box. (in a jist). With WS, the data flows from WS to App to Client? please correct me if i am wrong..

0
 
anushahannaAuthor Commented:
>>A single HTTP request response pair is probably 600 bytes too many

Would it be always more than a DB call from code?
0
 
rg20Commented:
the webservice follows the same path as the DB call, but then takes the extra step to forward to the client.

When you do DB to App box, the data is not transported to the client machine.
0
 
13598Commented:
The way I see it a web service is more secure. You present a 'static copy' of the data. You can try to hack it all you want but all you will get is the data. You won't get the data engine/database.
An app can potentially expose the actual database as well as logons, etc..
0
 
anushahannaAuthor Commented:
Thanks for your helpful input.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 7
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now