Ionic & postgresql database

Hi guys,

i’m new here and i’m started using ionic since two weeks. So , i have a website (that i created using laravel framework and i use postgresql). now i want to create an android/iOS application using ionic using the data which are stored in my website database (postgresql). could you give me more information about using database in client side and synchronize the all with my website database please.

Thank you in advance

Dear Pazzo06,

Can you give me more details of your app? Are you looking to store offline data, correct? You can use SQLLite if the data that is going to be stored is complex or you can use a text file if the data is simple. You can put them in synch using Json urls that have webservices connecting in your main external database. So, that makes it possible to you to be online(in-synch) and offline(with SQLlite) .

I hope it helps, otherwise, please give me more details about your project.

Thiago L Guimaraes
IONIC sample:


Personal Blog:

1 Like

Hi tlguimaraes,

Thank you for your answer. So to give you more details, i have a website that i created using laravel framework and i’m using postgresql as database, it’s a website that allow us to borrow cars, so in the database i have a lot of data (users, cars, cars coordinate in the map (latitude&longitude),…etc). In the website we can register, login, manage profil (and the admin can add cars, manage users…). Now i need an application (i choose ionic) which will allow me to login and borrow a car ( for this i will scan a QrCode present in every cars, take pictures proving the good state of cars and SEND ALL THESE data to a database). Because my app should be synchronized with my website, i need to use the data which are present in the database (login information, cars coordinate) in my app and in the other side i want to send information from my app to the postgresql database (picture, newest coordinate of the car…). I’m beginner with app developing and i don’t know what’s the good procedure to do this.

Thank you

This isn’t really related to ionic mobile apps or anything, you just need an API. Once you have an API, you can consume it from anywhere, including an Ionic app. But you have to write an API.

Hi rlouie,

Thank you for your answer, i don’t really understand, could we consider that Firebase for example can play the rule of this api? could you give me more information please or a good tutorial for developing this?

Thank you

Hi Pazzo,
I got a similar need to use Pg.
Have you suceed working something out so as for the Connection to your DB from an Android device ?
looking for any info.
Tks

No, you don’t. That’s a horrible idea. Create a REST backend that connects to the database, and have the Ionic app communicate via HTTP. You do not want direct database connections from mobile apps.

Tks, though I did not mention a direct connection…
(and yes I was thing of Rest)

Sorry then. The way you phrased it, specifically mentioning the database type and talking about “the connection to your DB from an Android device” made me jump to the conclusion that you were talking about a direct connection.

Yep, that was a bit direct, sorry :)…I’m seeing some ref.in examples so as to use firebase, still wondering what support is there to using postgresql instead…

I use postgresql for all my ionic application backends, but I write the application level server in Go.

Hi rapropos, do u have any reference that how to connect ionic2 and postgresql…?
which backend code is preferable?
Urgent!! Hope to see your reply soon…TQ.

Bonjour ! s’il vous plait j’aimerais utiliser postgresql comme base de données de mon application ionic et je ne sais comment m’y prendre. Alors je vous demande de l’aide avec votre méthode.

I also looking that type of solution i don’t know about postgresql but i found two video about how to do it with mysql. and i have no idea how to do synchronization i love to learn about it. I don’t know this form allow posting video links like “youtube”. If it is okay i will past them here it will may be give a little idea how this type of things work. Right now i am developing that watching the video :wink: