如何使用java访问远程mysql数据库 [英] How to access a remote mysql database using java

查看:491
本文介绍了如何使用java访问远程mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了 JAVA SWING应用程序。我想在多台计算机中安装此应用程序,所有都可以访问互联网
那么我应该在哪里放置我的MYSQL数据库?所有这些计算机都应该能够通过互联网访问同一个数据库。

I have already developed a JAVA SWING Application. I want to install this application in several computers which all have access to internet . So where should I place my MYSQL Database ? All these computers should have the ability to access the same database via the internet.

推荐答案

这不是非常常见的是允许直接通过Internet访问数据库以确保安全性(身份验证授权,加密)和性能原因。在大多数情况下,您将创建一个基于Web的服务器应用程序,该应用程序可以执行数据库操作,实施业务,域和安全规则。客户端应用程序通过互联网进行调用(使用REST调用,AJAX调用或某些专有的调用),并从服务器返回结果。

It's not very common to allow access to a database directly over the internet for security (authentication authorization, encryption) and performance reasons. In most cases, you would create a web-based server application which can perform database operations, enforcing business, domain, and security rules. The client application makes calls over the internet (using REST calls, AJAX calls, or something proprietary), and gets the results back from the server.

在您的情况下,因为您的客户端软件是Java,您可能想要研究 Java Servlets 并运行像 Tomcat 这样轻量级的东西。

In your case, since your client software is Java, you may want to research Java Servlets and run something lightweight like Tomcat as a serer.

请参阅此页此页面,了解客户 - 服务器关系。

Please see this page and this page for an explanation of client-server relationships.

这篇关于如何使用java访问远程mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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