I want to connect a MySql
DB with my android application.
However, I DON'T want to/CAN'T use PHP
for doing this.
Almost all solution for MySql
connection with android on internet uses PHP
.
I read somewhere that, If one don't want to use PHP
then web service
should be used.
But I'm not able to find any tutorial/sample example for the same.
Any help appreciated.
No you can't interact with MySQL through JavaScript or JQuery. You could use JavaScript and JQuery through your PHP pages if that would be a functionality you'd be interested in. You could also use another language compatible with MySQL. Otherwise interacting with MySQL straight through JavaScript/JQuery won't work.
Make an Android ASyncTask. This will accept the command and try to connect with your Database and on successful connection with MySQL assign a String variable with the table data. And now run your application. On Pressing on the “Fetch Data” button it will fetch Data from MySQL Database table.
The JDBC API is an alternative to the drop-in replacement. It is possible to build Berkeley DB SQL for Android in such a way that a JDBC API is exposed to Android application developers. This is done using the Android NDK. This section describes how to build and use the BDB JDBC driver for Android.
Sorry, you cannot connect to database without having a backend environment setup. XAMPP is a widely known package that gives you PHP, MySQL, and Apache Web Server to let you create web pages using a relational database. With 1 install, it gives you everything you need for a full-stack website.
It seems you're mixing up some things.
A web service is simply some code on the internet (web) which allows you to receive and send information to a server, where it is saved per example in a database.
PHP is just a language, in which you can write a web service.
You can use a vast array of languages to create a web service ( read: expose your database) to other devices. Among others, you can easily do this in Java, .NET, Python ...
If you're looking for a way to connect to an external database without any web service / API in between, i'll have to disappoint you with the news that this is not supported by Android.
Most examples of a simple web service / a bunch of scripts contain PHP since this is probably the easiest and can be used on pretty much any server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With