Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting MySql with Android without using PHP

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.

like image 784
GAMA Avatar asked Jan 03 '13 10:01

GAMA


People also ask

Can I use MySQL without PHP?

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.

Can we connect MySQL with android?

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.

Can I use JDBC in Android?

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.

Can we connect HTML with database without PHP?

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.


1 Answers

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.

like image 62
Stefan de Bruijn Avatar answered Sep 28 '22 00:09

Stefan de Bruijn