如何用Delphi实现可访问Internet的系统?

发布于 2024-09-29 06:42:09 字数 252 浏览 5 评论 0原文

我即将开始开发一个新系统,该系统需要支持多个用户,并可能允许通过互联网访问数据库。

该系统将是 win32,而不是基于 Web,数据库将位于办公室并可在任何地方访问。我不确定这是否是一种危险的安全方法,我愿意接受建议

数据库将是 SQL Server,系统将在 Delphi 6 中实现

有谁知道我如何开始这个?我还需要考虑记录锁定。

如果有人可以提供好文章的链接,我们将不胜感激。

干杯

保罗

I am about to start working on a new system which will need to support multiple users and potentially allow the database to be accessed over the Internet.

The system will be win32, not web based, the database will just be in an office and accessible anywhere. I am not sure if this is a dangerous approach security wise, am open to suggestions

The database will be SQL Server and the system will be implemented in Delphi 6

Does anyone know how I go about starting this? I will need to take into account record locking as well.

If anyone could provide links to good articles that would be appreciated.

Cheers

Paul

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

蹲墙角沉默 2024-10-06 06:42:09

恕我直言,对您来说最简单的方法是创建一个 VPN,通过互联网安全地公开您的数据库。

安全性将非常好,因为只有通过受信任的 VPN 连接才能访问数据库。

您的数据库可以从任何地方访问,使用互联网作为安全传输数据库数据包的隧道。

因此,您的 Delphi 代码将像平常一样使用 TCP/IP 连接,通过 VPN 安全隧道连接到数据库。

无需添加额外的仅限 Delphi 的工件,例如 Indy 组件等。
并且您将能够连接到非 Delphi 客户端的数据库,这可能是使用某些数据库浏览工具的好主意。

IMHO, the easiest way for you is to create a VPN exposing securely your database over Internet.

Security will be very good, because access to the database will be available only through a trusted VPN connection.

And your database will be available from anywhere, using the Internet just as a tunnel to transport your database packets safely.

So your Delphi code will connect to the database just as usual, using TCP/IP connection, via the VPN secure tunnel.

No need to add additional Delphi-only artifacts, like Indy components and such.
And you will be able to connect to your database for not-Delphi client, which could be a good idea to use some database browsing tool.

む无字情书 2024-10-06 06:42:09

将数据库暴露在互联网上存在安全风险。安全漏洞很容易被远程利用。

解决方案是:

  1. VPN,如其他答案中所述。简单且安全,但需要在两个端点(客户端和 VPN 服务器)上进行一些设置,并且可能需要在服务器(或 VPN 路由器/设备)上以及客户端(如果您不使用标准 VPN)上安装适当的软件协议)。
  2. n 层应用程序,其中仅应用程序服务器暴露于互联网。还是要妥善保护应用服务器和传输通道。可能需要较少的客户端设置。 Delphi 6 提供 Datasnap 作为 n 层库(它仍然支持 CORBA,但从 D7 开始就被删除了)。 DCOM 不是非常适合防火墙(但可以配置为跨它们工作),但可以自行保护通道,其他两个选项(套接字和 HTTP)更容易设置,但安全性稍差(它们使用 DCOM 代理工作,因此,客户端身份会丢失,并且需要自定义代码或证书来保护通道)。
  3. 第三种解决方案可能是让用户通过远程桌面进行远程连接,但它需要许可证和能够维持远程会话负载的计算机。

记录锁定由数据库本身处理 - 请仔细阅读有关 SQL Server 锁定模式的文档,以避免以后出现意外情况。如果连接速度不够快,您可以选择在客户端缓存一些数据(TClientDataset 非常适合),它也可以减少锁定问题,但可能会引入更新冲突。

Exposing the database on the Internet is a security risk. Security flaws could be easily exploitable remotely.

Solutions are:

  1. VPN, as said in other answers. Simple and secure, but requires some setup on both end-ponts (clients and VPN server), and may require proper software on the server - or a VPN router/appliance - and on the client as well if you're not using standard VPN protocols).
  2. A n-tier application, where only the application server is exposed to the internet. You still have to protect the application server properly and the transmission channel. May require less setup on the client side. Delphi 6 offers Datasnap as a n-tier library (it also still supports CORBA, but it was dropped since D7). DCOM is not very firewall friendly (but can be configured to work across them) but can secure the channel on its own, the other two options (socket and HTTP) are easier to setup but a little less secure (they work using DCOM proxies, thereby the client identity is lost, and require custom code or certificates to secure the channel).
  3. A third solution could be to let user connect remotely via remote desktop, but it requires licenses and a machine able to sustain the remote sessions load.

Record locking is handled by the database itself - read the documentation about SQL Server locking mode carefully to avoid bad surprises later. If the connection is not fast enough you may choose to cache some data on the client side (TClientDataset works well for that) and it can also reduce locking issues, but it can introduce udpate conflicts.

姜生凉生 2024-10-06 06:42:09

您可能指的是通过 TCP/IP 进行通信的客户端服务器系统。

您可以使用 Indy 组件来创建它。请务必检查示例,因为它们不容易使用,但您可以创建几乎任何与它们相关的网络。

You probably mean a client server system that communicates trough TCP/IP.

You can create this using the Indy components. Be sure to check the examples because they are not easy to use, but you can create almost anything network related with them.

吝吻 2024-10-06 06:42:09

实际上,有数十种可能的技术,具体取决于您的经验、偏好和可用的工具。不过,我建议您使用 ADO 而不是 BDE 连接到数据库。为此,您可以使用 Delphi 中的 ADO 组件或将 msado15.dll 类型库导入到您的项目中以使用原始 ADO API 调用。后者将需要更多的经验!
SQL Server 能够将自己暴露在 Internet 上,尽管这会带来安全风险。尽管如此,想要访问它的人仍然需要用户名和密码才能建立连接,并且您需要打开 SQL Server 使用的端口。但从技术上讲,要在 Internet 上使用 ADO,您只需知道工作服务器的 IP 地址以及登录信息即可。但这是一个安全风险。出于这个原因,大多数开发人员不会将 SQL Server 暴露给数据库,而只是编写 Web 服务来包装您想要公开的特定数据库功能。
记录锁定是 SQL Server 将为您做的事情,如果您使用事务可以使其更加安全。

最后,您需要学习和阅读的内容在很大程度上取决于您想要在应用程序中执行的操作。因此,在开始编写代码之前,请开始编写功能设计,以概述您想要什么以及为此需要什么。从本文档开始,开始编写技术文档,以更准确地描述您的代码需要执行的操作。一旦你有了这个,你就可以就你需要但目前不知道的事情提出更直接的问题。

Actually, there are dozens of techniques possible, depending on your experiences, preferences and tools that you have available. I would advise you to use ADO to connect to the database and not the BDE, though. To do this, you can use the ADO components that are part of Delphi or import the msado15.dll type library into your project to use raw ADO API calls. The latter will require a lot more experience!
SQL Server is able to just expose itself to the Internet, although this creates a security risk. Still, someone who wants to access it will need a username and password to get a connection and you would need to open the ports that SQL Server uses. But technically speaking, to use ADO over the Internet, all you need to know is the IP address of a working server, plus login information. It's a security risk, though. And for that reason, most developers will not expose SQL Server to a database but just write web services to wrap around the specific database functions that you want to expose.
Record locking is something SQL Server will do for you, and if you use transactions you can make it even a bit more secure.

In the end, the things you need to learn and read about depend heavily on the things you want to do in your application. So before you even start to write some code, start writing a functional design to get an overview of what you want and what you would need for this. From this document, start writing technical documents to describe more precisely what your code needs to do. Once you have this, you can ask more direct questions about the things you need, yet don't know at the moment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文