从网络服务器使用MySQL的Windows应用程序 [英] Windows application using MySQL from a webserver

查看:151
本文介绍了从网络服务器使用MySQL的Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的老板要我创建一个数据库,该数据库可以通过互联网访问一个桌面应用程序。该数据库用于存储来自TCP服务器获取的信息,但是这不是我的问题。

My boss wants me to create a desktop application with a database that is accessible via the Internet. The database is used to store information taken from a TCP server, but that is not my question.

到目前为止,我的研究,我发现共享虚拟主机,VPS,主机租用和亚马逊RDS是可能的选择。我唯一​​的兴趣是包含给定包中的MySQL服务器。

so far on my research, I found shared web hosting, VPS, dedicated hosting and Amazon RDS to be possible choices. The only interest I have is the MySQL Server included in the given package.

我觉得对于一个简单的应用常规共享虚拟主机是不够的,仅仅是因为数据库是由10个表和记录将不太可能超过一千多的记录。

I think for a simple application a regular shared web hosting is enough, merely because the database is consists of 10 tables and records won't likely exceed more than a thousand records.

但我的问题是,是否有可能直接从Web服务器连接 C#应用程序到MySQL实例?而如果它是它安全吗?这将是存储的重要信息,如信用卡号码,会员信息,需要将所有的时间。

But my question is, is it possible to directly connect a C# application to a MySQL instance from a web server? And if it does is it secure? It will be storing vital information such as credit card numbers, and member information and needs to be up all the time.

推荐答案

您可以轻松地从任何一台电脑,只要你的防火墙没有阻止端口3306的数据库服务器上连接到MySQL数据库。不过,我强烈建议,因为你这样做失去控制了客户端阻止你。

You can easily connect to a MySQL database from any computer as long as your firewall do not block port 3306 on the database server. However, I strongly discourage you from doing so since you loose control over the clients.

  • 在每个客户端都需要在一些地方保存数据库连接(或者从某种类型的服务器获取)
  • 您需要能够更新所有客户端上的MySQL Connector
  • 您得到很少的控制数据访问。

相反,我会介绍一些该客户端将使用数据访问层。你可以如使用 WCF数据服务或建立自己的非常简单的数据层(让客户端发送SQL查询和使用 WCF 返回正确的结果)。

Instead I would introduce some kind of data access layer that the clients would use. You could for instance use WCF Data Services or build your own very simple data layer (let the clients send SQL queries and return the proper result) using WCF.

这两项选项可以让你使用任何技术落后(你甚至可以切换数据库服务器没有注意到的客户)。

Both those options lets you use any technology behind (you can even switch database server without the clients noticing).

这篇关于从网络服务器使用MySQL的Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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