最佳实践:对Web服务的直接SQL访问 [英] Best Practice: Direct SQL Access vs. Web Service

查看:124
本文介绍了最佳实践:对Web服务的直接SQL访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于同时具有Web和桌面客户端版本的应用程序:




  1. 什么是对于桌面客户端,需要一个访问SQL Server最佳实践?

  2. 什么是从应用程序使用VS Web服务连接到数据库的好处?

  3. 哪一个提供了更好的安全性?

  4. 会叫什么类型的范围一VS其他(企业内网与Web应用程序等)

  5. 是否有其他方面的考虑在平台上?


解决方案<选择时所必需/ DIV>

什么是桌面客户端,需要访问到SQL Server?




的最佳实践

如果您使用的是本地SQL Server然后直接访问数据库。如果客户端具有到另一系统上使用一个SQL数据库,使用Web服务的优选额外的保护,并具有应该能够处理多个用户的业务层的附加优点




什么是连接到数据库中的应用程序VS使用Web服务的好处?




通过Web服务连接将永远是有点慢和修改数据库会有点难度添加到整个系统。 (基本上,这将意味着你需要创建Web服务的一个新版本,同时保持向后兼容旧的Web服务。)




哪一个提供了更好的安全性?




使用Web服务往往是更安全,但安全性往往是多的的问题,不是软件的问题。但与用户和数据库之间的网络服务,到数据库的连接更加安全,因为用户不能直接访问它。 (除了功能,通过Web服务提供的。)这一点是没有实际意义时,客户端和数据库都在同一系统上,因为这样用户可以得到完全访问权限。




会叫什么类型的范围一VS其他(企业内网与Web应用程序等)




Web服务是客户端 - 服务器应用程序,用户不应该直接访问数据库更好。否则,直接数据库连接只会提高性能。
当创建一个Web服务,通​​过编写一个通用的(类)库,这将提供Web服务的功能启动。解决这个(业务)库创建一个Web服务,暴露在外界的重要方法。任何网站可以直接调用这个库,而无需使用Web服务,虽然你总是可以选择,甚至通过Web服务让网站代码访问的数据。
即使创建只是一个本地数据库的桌面应用程序,撰写商业库逻辑来访问数据库仅仅是一个做的非常好的事情。您的客户端可以直接或通过Web服务调用此业务库,根据您的需要。




是否还有其他方面的考虑是必要的时候选择平台上?




大多只是说你愿意用它来设定一些东西的硬件数量。如果你能负担得起建立一个数据库服务器,为服务一个单独的Web服务和第三为您的网站,有十几家客户机系统,那么你可以选择最分层版本,在客户端和网站在Web服务,这就要求数据库调用。但如果一切都需要一个单独的系统上运行,那么只要坚持到应用程序和业务层/库,而不是



添加图层将减少从单一的视图性能用户,虽然。然而,具有多个层的工作能提高整体性能,因为资源得到之间的多个用户划分更好。


With respect to an application that has both a web and desktop client version:

  1. What is the best practice for the desktop client which needs access to a SQL Server?
  2. What are the benefits of connecting to the database from the application vs using a web service?
  3. Which one provides better security?
  4. What type of scope would call for one vs the other (enterprise intranet vs. web app, etc)
  5. Are there any other considerations that are necessary when choosing on platform?

解决方案

What is the best practice for the desktop client which needs access to a SQL Server?

If you're using a local SQL Server then access the database directly. If the client has to use an SQL database on another system, the use of a web service is preferred for an additional protection and the added advantage of having a business layer that should be able to handle multiple users.

What are the benefits of connecting to the database from the application vs using a web service?

Connecting through a web service will always be a bit slower and modifications to the database will be a bit more difficult to add to the whole system. (Basically, that would mean that you need to create a newer version of the web service while maintaining the older web service for backwards compatibility.)

Which one provides better security?

The use of web services tends to be safer, although security is often more a people issue than software issue. But with the web service between the user and the database, the connection to the database is more secure since the user cannot directly access it. (Except for the functionality you provide through the web service.) This point is moot when client and database are on the same system because then the user can get full access.

What type of scope would call for one vs the other (enterprise intranet vs. web app, etc)

Web services are better for client-server applications, where users should not have direct access to the database. Otherwise, a direct database connection would just improve performance. When creating a web service, start by writing a generic (class) library which will provide the functionality for the web service. Create a web service around this (business) library, exposing the important methods to the outside world. Any web site could call this library directly without using the web service, although you can always opt to even let the web site code access the data through the web service. Even if you create just a desktop application with a local database, writing a business library with logic to access the database is just a very good thing to do. Your client could call this business library directly or through a web service, depending on your needs.

Are there any other considerations that are necessary when choosing on platform?

Mostly just the amount of hardware that you're willing to use to set things up. If you can afford to set up a database server, a separate web service for the services and a third for your web site, with a dozen or so client systems, then you can opt for the most layered version, where both client and web site call upon the web service, which calls the database. But if everything needs to run on a single system then just stick to the application and the business layer/library instead.

Adding layers will reduce performance from the view of a single user, though. However, working with multiple layers can improve the overall performance because resources get divided better amongst multiple users.

这篇关于最佳实践:对Web服务的直接SQL访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆