简体   繁体   English

在Java程序和MySQL数据库之间建立通信

[英]Establishing a communication between Java program and MySQL database

I am having Java program and MySQL database running on the remote server. 我正在远程服务器上运行Java程序和MySQL数据库。 Now what I want is to establish a communication and to be able to execute queries (select, insert, delete, update) from java program to make effect in the database. 现在,我想要建立一个通信并能够从Java程序中执行查询(选择,插入,删除,更新)以在数据库中生效。 I do know that there is a library (JDBC MySQL connector) that allows me to connect my Java program with the database. 我确实知道有一个库(JDBC MySQL连接器),它使我可以将Java程序与数据库连接。 I also know it is possible to execute queries right from the Java program using MySQL JDBC interface. 我也知道可以使用MySQL JDBC接口直接从Java程序执行查询。 My question is, however, if this "kind" of communication with the database stored on the remote server is safe enough. 但是,我的问题是,与远程服务器上存储的数据库进行这种“通信”是否足够安全。 I have also read there is an option of using PHP/Pearl to do that. 我还阅读了使用PHP / Pearl进行此操作的选项。 So my question is: 所以我的问题是:

What is the best option/solution in establishing a connection between Java program and the MySQL database running on the remote server over the internet? 在Java程序和通过Internet在远程服务器上运行的MySQL数据库之间建立连接的最佳选择/解决方案是什么?

My question is, however, if this "kind" of communication with the database stored on the remote server is safe enough. 但是,我的问题是,与远程服务器上存储的数据库进行这种“通信”是否足够安全。

Modulo the question of what you really mean by "safe enough", the answer could be Yes ... if you take reasonable precautions. 以“足够安全”为真正含义的模数问题,如果采取合理的预防措施,答案可能是“是”。 For example: 例如:

1 - This deals with a different mode of "attack" ... but it is actually a common. 1-这涉及“攻击”的另一种模式……但这实际上是常见的。


You also need to balance your need for remote database access against your security and risk management. 您还需要平衡对远程数据库访问的需求与您的安全性和风险管理。 For instance, if the potential consequences of a security breach are dire, then maybe you shouldn't even contemplate doing database access over the internet. 例如,如果安全漏洞的潜在后果很严重,那么您甚至不应该考虑通过Internet进行数据库访问。


What is the best option/solution in establishing a connection between Java program and the MySQL database running on the remote server over the internet? 在Java程序和通过Internet在远程服务器上运行的MySQL数据库之间建立连接的最佳选择/解决方案是什么?

I don't think we can answer that. 我认为我们无法回答。

Maybe your database only accepts php-scripts from the same server for security reasons. 出于安全原因,也许您的数据库仅接受来自同一服务器的php脚本。 A possibility is: https://stackoverflow.com/questions/21882135/how-to-send-data-from-java-applet-to-php-to-mysql-and-read-data-from-mysql-to-ph 一种可能是: https : //stackoverflow.com/questions/21882135/how-to-send-data-from-java-applet-to-php-to-mysql-and-read-data-from-mysql-to-酸碱度

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

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