用java连接mysql数据库 [英] Connecting to mysql database with java

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

问题描述

先生...我正在开发一个java应用程序.这个应用程序需要连接mysql数据库服务器.要用java连接数据库,我们需要包含mysql-connector.jar文件.所以我已经包含了这个,我是连接到我的数据库.但这里的问题是在这个应用程序完成后,这么多用户将使用它.所有这些用户都需要在他们的 java 目录中包含 mysql-connector.jar 文件才能运行这个应用程序.如果每个人都需要包含那个 .jar 文件,这个应用程序用户就会面临问题.那么我们有没有其他方法来连接数据库而不使用 java 中的任何驱动程序

Sir...i am developing a java application .This app has need to connect the mysql database server.To connect the database with java we need to include mysql-connector.jar file.so i have included this and i am connecting to my database.But here the problem is After completion of this app so many users wiil use it.Does all those users need to include mysql-connector.jar file in their java directory to work this app. This app users face problem if everyone need to include that .jar file.So do we have any other way to connect the database without using any driver in java

推荐答案

MYSQL 驱动程序必须驻留在访问 MySQL 数据库的 Java 应用程序的类路径中.如果客户端上运行的java应用直接访问MySQL,那么是的,每个用户都必须有jar.

The MYSQL driver must reside on the classpath of the Java application that accesses the MySQL database. If the java application running on the client directly accesses MySQL, then yes, each user must have the jar.

避免这种情况的一种方法是将与数据库交互的代码放在服务器上,然后让客户端应用程序远程调用该服务器应用程序.

One way to avoid this is to place the code that interacts with your database on a server, then have the client application make remote calls to that serer application.

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

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