I am having Java program and MySQL database running on the remote server. 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. I do know that there is a library (JDBC MySQL connector) that allows me to connect my Java program with the database. I also know it is possible to execute queries right from the Java program using MySQL JDBC interface. 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. 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?
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:
use PreparedStatement
and query parameters to avoid problems with SQL injection 1
if possible, use a properly secured private network (for example a VPN) for java <-> database traffic
if you can't secure the network, use SSL; eg http://dev.mysql.com/doc/refman/5.0/es/connector-j-reference-using-ssl.html
secure your database accounts and your authentication credentials.
1 - This deals with a different mode of "attack" ... but it is actually a common.
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.
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?
I don't think we can answer that.
Maybe your database only accepts php-scripts from the same server for security reasons. 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.