How to create connection between my Ionic application and a MySql database?

Hello , i want to know how to create a connection between a mysql data base using java or php to my ionic v3 application.

Use the frameworks network calls, e.g. Angular’s HTTP get, and call the api that you wrote on your server to interact with your database.

1 Like

Hello , sorry , i do not understand .
what do you mean about call the api that i wrote on my server?

All i know is that i want to connect the database to the ionic application but i do not know how to use any api and even what are they , :smiley:

You are going to have spend some time learning the,but that is the life of programmer. You can’t talk directly to the database from Ionic. There will need to be some code that your Ionic app will make a call to that in turn will perform the database query and return the result. A common combination will be PHP and MySQL. You will write PHP code that will take in the request, perform the query on the database and then return the result. All of this is on a server and NOT in your Ionic application.

On the Ionic side, Angular’s HTTP module allows you to call that remote PHP code and await the response.

I would suggest finding some courses on this topic.

1 Like

Sir , Thank you , i am searching about doing this using java language not php , is it possible?

do u suggest me any good course ?

What others are trying to explain to you is you can’t access MySQL directly from Ionic; you need a “middleman” that accepts HTTP requests, i.e., a WEB SERVICE. So you need to create a WebService (using Java, for example) that accept HTTP requests, then connect with your MySQL database, perform the requested operation and return a response in some kind of format (JSON, XML).

Then, you can write code in Ionic to send requests to that webservice and receive the response sent back by your webservice.