简体   繁体   English

如果防火墙开启,则android应用无法连接到数据库

[英]android app cannot connect to database if firewall is on

My app connects to local SQL Server using jtds. 我的应用程序使用jtds连接到本地SQL Server。 When I turn off the Windows Firewall, the application can access the local database. 当我关闭Windows防火墙时,应用程序可以访问本地数据库。 When it is turned on, it cannot access the local database. 打开它时,它无法访问本地数据库。 Does anyone know a way do let the app connect to local database without turning off the firewall. 有谁知道一种在不关闭防火墙的情况下让应用连接到本地数据库的方法。

Edit: tag added for sql-server 编辑:为sql-server添加标签

Strictly speaking 严格来讲

Turn firewall on. 打开防火墙。 Open port 1433 打开端口1433

But typically you do not expose your database to the world. 但是通常您不会将数据库公开。 Best practices it is a no starter. 最佳实践是没有开始的。

Rather, you would keep the port closed and the client layer is accessing port 80 to get aspx or php that would in turn (internal to your network) access the db. 相反,您将保持端口关闭,并且客户端层正在访问端口80以获取aspx或php,而后者又将(在您的网络内部)访问数据库。

So it is common to do that. 因此,通常这样做。 But if you are just playing around different matter. 但是,如果您只是在玩另一回事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM