简体   繁体   English

如何将Android应用程序连接到笔记本电脑,PC或服务器上的MySQL数据库?

[英]How do I connect my Android app to a MySQL database on a laptop, PC, or server?

How do I connect an Android device to a PC, laptop, or server? 如何将Android设备连接到PC,笔记本电脑或服务器?

I have finished my Android program using Eclipse. 我已经使用Eclipse完成了Android程序。 I also use a client - server system (I'm using MySQL, not SQLite, to store my database) 我还使用客户端服务器系统(我使用的是MySQL,而不是SQLite,用于存储数据库)

when I run my program in emulator, it runs nicely (using CustomHTTPClient with address to connect MySQL is http://10.0.2.2/android/blablabla.php ) 当我在模拟器中运行程序时,它运行得很好(使用具有地址的MySQL的CustomHTTPClient连接MySQL是http://10.0.2.2/android/blablabla.php

But, will it be the same code to connect to a MySQL database when I deploy the app onto a real device? 但是,将应用程序部署到真实设备上时,连接到MySQL数据库是否会使用相同的代码? if no, what should I do to connect the device to my database(MySQL) in my PC/Laptop/Server? 如果不是,我该怎么做才能将设备连接到PC /笔记本电脑/服务器中的数据库(MySQL)? How should I change the code? 我应该如何更改代码?

I don't use Bluetooth because the distance is too short. 我不使用蓝牙,因为距离太短。

You could use your computers IP address. 您可以使用计算机的IP地址。 Find this by tpying 'ipconfig' into the command prompt. 通过在命令提示符下键入“ ipconfig”来查找此内容。 Look for and use your IPv4 address, it should be similar to: 查找并使用您的IPv4地址,该地址应类似于:

192.168.0.XX/android/blablabla.php

You just have to make sure that the Android phone is connected to the same network the PC/Server is in and replace 10.0.2.2 with the ip address of the Server. 您只需要确保Android手机连接到PC /服务器所在的同一网络,然后用10.0.2.2的IP地址替换10.0.2.2 I assume that you don't have a domain. 我假设您没有域。

暂无
暂无

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

相关问题 如何将我的Android应用程序连接到远程MySQL数据库? - How do I connect my Android app to a remote MySQL database? 如何将 Azure MySQL 数据库连接到我的 iOS 和 ZE84E30B9390CDB646DB6DB2C9AB878 应用程序 - How do I connect an Azure MySQL Database to my iOS and Android App 如何使用Android应用程序连接到MySQL数据库? - How can i connect to my MySQL database with an android app? 如何将我的 Android 应用程序与在线 mysql 数据库连接? - How can i connect my Android app with the online mysql database? 如何将Android应用程序连接到非本地的mysql数据库? - How do I connect a android app to a mysql database that is not local? 如何将在 android 设备中运行的 Ionic 应用程序连接到我的电脑(本地主机)中的节点服务器? - How can I connect my Ionic app running in my android device to my node server in my pc (localhost)? 如何将Android设备连接到笔记本电脑(适用于我的应用程序)? - How should I connect my Android Device to my laptop(for my app)? 如何将数据库连接到 Android 应用程序? - How do I connect a database to an Android app? 如何使用我的Android设备上的应用程序连接到在我的PC上运行的服务器 - How to connect to a server running on my pc using my app on my android device 如何制作将笔记本电脑用作服务器的Android SQLite数据库? - How can I make an Android SQLite database that uses my laptop as a server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM