Mysql connect with Android Java?

Dear Sir,

I am a beginner in Android App development and I am currently trying to establish a connection between my Android Studio Java project and my MySQL database. The MySQL database is running perfectly on my computer with XAMPP server, specifically version 5.2.1 (as shown in phpMyAdmin update). The IP address I am using is 192.168.0.101 and the port is set to 3306. I have created a database named “testdb” and a table named “testtb”. The MySQL root user password is null (empty).

However, when I tried to connect using the JDBC connector 5.1.4 in Android Studio Java, I encountered an error. I would greatly appreciate it if you could suggest the best JDBC connector for my MySQL database to establish connectivity with Android Studio Java.

Furthermore, I kindly request you to provide me with the simplest code for establishing connectivity in one screen, specifically for the onclick event.

Thank you for your assistance.

Sincerely,

1 Like

Hi there, technly speaking you might even be able to do that…
but that’s not recommended for many reasons…

What people usually do is to create a rest webservice that connects to the database and then communicate with it through https.

you can read more about here java - Can we connect remote MySQL database in Android using JDBC? - Stack Overflow

1 Like