Connecting to a company database using a programming language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Connecting to a company database using a programming language

How would I get information from a company database for products etc and have it appear in an app that shows them and if a price changes it updates it

6th Dec 2018, 10:25 PM
James Layton
James Layton - avatar
5 Answers
+ 1
You could use any programming language to write the API that receives data from the database, after running a query and sends it to the front-end. Most commonly used are languages like PHP, Python (with Flask/Django frameworks, etc.), even Node.js, which is a javascript library that allows you to run javascript on the back-end. Regardless of what implementation you decide to use, the standard process in modern web development is by using AJAX (Asynchronous Javascript And XML). The process goes like this: 1) Client sends a HTTP request (POST or GET in your situation) with some parameters, using vanilla JS or jQuery. Parameters could be the product ID(s) for example, so that the back-end knows what to send back as a response. Request parameters are in JSON or in XML format when working with RESTful APIs (JSON is most commonly used) or solely in XML when using SOAP APIs. 2) Handle the request with a language like PHP and store the received parameters to use them in the query that you are going to write in SQL.
6th Dec 2018, 11:49 PM
Manos Liakos
Manos Liakos - avatar
+ 1
Then run the SQL query and store the result in a variables. Send it back to the front-end as a response in an object or an array. 3) Handle the response with JS and parse values to JSON. Create maybe an array and loop through the elements appending them to the DOM. If the data displayed is fetched from the server it will always be up to date when something changes. Hope that helped, do ur research :)
6th Dec 2018, 11:50 PM
Manos Liakos
Manos Liakos - avatar
+ 1
Ok thanks i ask cus i was wanting to create an app for the range store for ios which keeps up with proces etc and offers
7th Dec 2018, 6:27 PM
James Layton
James Layton - avatar
0
can i do that using swift
7th Dec 2018, 5:42 AM
James Layton
James Layton - avatar
0
There is a SDK called perfect that allows you to do that, but I don't know much about it.
7th Dec 2018, 12:08 PM
Manos Liakos
Manos Liakos - avatar