Solved

webservice vs code connection string

Posted on 2010-08-24
15
370 Views
Last Modified: 2013-11-27
what is the primary difference between getting data through a webservice versus getting it through a connection string in the application code?

thanks
0
Comment
Question by:anushahanna
  • 7
  • 4
  • 2
  • +2
15 Comments
 
LVL 9

Accepted Solution

by:
rg20 earned 250 total points
Comment Utility
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
 
LVL 58

Assisted Solution

by:cyberkiwi
cyberkiwi earned 125 total points
Comment Utility
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
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
>>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
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 63 total points
Comment Utility
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
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
>>#1 use for webservices

if port issues were not present, would WS be still your choice?
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
>>you can extract whatever data you might happen to want or need.  

only if appropriate permissions are given to that SQL account, right?
0
 
LVL 9

Assisted Solution

by:rg20
rg20 earned 250 total points
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 6

Author Comment

by:anushahanna
Comment Utility
>>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
 
LVL 9

Assisted Solution

by:rg20
rg20 earned 250 total points
Comment Utility
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
 
LVL 58

Assisted Solution

by:cyberkiwi
cyberkiwi earned 125 total points
Comment Utility
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
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
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
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
>>A single HTTP request response pair is probably 600 bytes too many

Would it be always more than a DB call from code?
0
 
LVL 9

Assisted Solution

by:rg20
rg20 earned 250 total points
Comment Utility
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
 
LVL 16

Assisted Solution

by:13598
13598 earned 62 total points
Comment Utility
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
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
Thanks for your helpful input.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

10 Experts available now in Live!

Get 1:1 Help Now