简体   繁体   English

如何在没有互联网连接的情况下从 Android 设备访问 mysql 数据库?

[英]How to access mysql database from Android device without internet connectivity?

I am implementing an app which has a database that contains millions of values and is located on a PC(Server) .我正在实现一个应用程序,它有一个包含数百万个值的数据库,位于 PC(Server) 上。 Now provided, I won't have an active internet connection, what option do I have to connect with the mysql database?现在提供,我将没有活动的互联网连接,我必须使用什么选项来连接 mysql 数据库? Is it possible to implement this using a wireless LAN?是否可以使用无线 LAN 来实现?

如果您必须离线访问,我唯一的想法是将数据加载到 xml 或 JSON 文件中,尽管这不是一种有效或安全的方式(取决于您的数据是什么),这可能是您的一个选择

Yes you can connect it without the internet all you have to do is start the Wifi hotspot of your mobile device and connect your laptop to the wifi network of your mobile是的,您可以在没有互联网的情况下连接它,您所要做的就是启动移动设备的 Wifi 热点并将笔记本电脑连接到手机的 wifi 网络

the mobile and the PC(server)should be on the same network assuming that you are using XAMPP server go to the folder where you installed XAMPP on PC and search for httpd-xampp config file inside XAMPP\\apache\\conf\\extra假设您使用的是 XAMPP 服务器,移动设备和 PC(服务器)应该在同一网络上,转到您在 PC 上安装 XAMPP 的文件夹,并在 XAMPP\\apache\\conf\\extra 中搜索 httpd-xampp 配置文件

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
   # Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

find and comment the Require local查找并评论 Require local

Now grant the privileges to the database user to connect with % ie any host现在授予数据库用户连接 % 即任何主机的权限

Open Command Prompt and type ipconfig there you will find the IpV4 address打开命令提示符并在那里输入 ipconfig 你会发现 IpV4 地址

use that address for the connection string ie.将该地址用于连接字符串,即。

connection=DriverManager.getConnection("jdbc:mysql://192.168.x.xxx/databasename","username","password");

and you can connect get the connection to the database你可以连接获取到数据库的连接

Android with mysql connectivity without JSON or PHP Android with mysql connectivity带有 mysql 连接的 Android 没有 JSON 或 PHP带有 mysql 连接的 Android

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

相关问题 来自Android设备的远程MySQL数据库连接 - Remote MySQL database connectivity from android device 从没有热点的智能手机在 Android 设备上获取 Internet 访问权限 - Get Internet Access on a Android device from a smartphone without hotspot 未经ACCESS_NETWORK_STATE权限检查Android中的互联网连接 - Checking internet connectivity in Android without ACCESS_NETWORK_STATE permission 如何在远程android设备中检查互联网连接? - How do i check internet connectivity in remote android device? Android与mysql数据库的连接 - Android connectivity with mysql database 如何在没有PHP的情况下从android访问mySQL数据库 - how to access mySQL database from android without php 远程设备Internet连接状态-Android - Remote Device Internet Connectivity Status - Android 如何从互联网访问在Android设备上运行的网络服务 - How to access network service running on Android device from internet 如何在Android中检查互联网连接? - How to check internet connectivity in android? 如何在Android中检查网络内的互联网连接(通过HOTSPOT使用其他设备的互联网) - How to check the internet connectivity within the network in Android (using internet of some other device through HOTSPOT)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM