如何用Delphi实现可访问Internet的系统?
我即将开始开发一个新系统,该系统需要支持多个用户,并可能允许通过互联网访问数据库。
该系统将是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
恕我直言,对您来说最简单的方法是创建一个 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.
将数据库暴露在互联网上存在安全风险。安全漏洞很容易被远程利用。
解决方案是:
记录锁定由数据库本身处理 - 请仔细阅读有关 SQL Server 锁定模式的文档,以避免以后出现意外情况。如果连接速度不够快,您可以选择在客户端缓存一些数据(TClientDataset 非常适合),它也可以减少锁定问题,但可能会引入更新冲突。
Exposing the database on the Internet is a security risk. Security flaws could be easily exploitable remotely.
Solutions are:
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.
您可能指的是通过 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.
实际上,有数十种可能的技术,具体取决于您的经验、偏好和可用的工具。不过,我建议您使用 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.