I want to connect my android application with a SQL database which is stored in an another computer. I want to use that computer as a server. I think there is a method to connect with that server computer using it's IP address. I use android studio when developing the android application.
Can anyone help me to fix this problem?
I would not recommend you to connect directly to the database from the application, if you plan to publish the app. You open a port to the database server to everyone and store the password to the database in the user device. Anyone who wants to retrieve data from your SQL Server just needs to open the application in a hex editor or decompile it in order to retrieve the password.
Always use an API through a webserver that gets you desired information.
You could use the Firebase Realtime Database to sync specific data, if you do not trust Google then build your own API.
https://firebase.google.com/docs/database/
Related
I wand to access the postgreSQL database from android using Pydroid3 application in my mobile phone. to access postgreSQL database i need to import psycopg2, but android doesn't support this.
can anyone please suggest the way to solve this issue.
With Android you typically don't make a hard database connection, unless its a local one.
psycopg2 doesn't work for the same reason you're not supposed to use JDBC . You should talk to a remote database via a RESTful API, meaning a server sends you data that it itself retrieves from the database.
So your next step would to create a web site/service that handles GET requests. So your app can talk to it, and it can talk to the database.
So, the scenario is i have a MYSQL database stored on local system on SQL server 2008 which is turned ON 24/7 and is connected to internet. there is no API, no web services.
Now, i want to develop a android application which can fetch data from that server. and that app should be able to get the data no matter from where the app is getting accessed.
i somewhere read that it is possible by connecting via IP address but could't find proper reference for it and i never done it before.
i can connect android app if the database is stored on cloud but this one is on local system.
so tell me the possible ways to connect android app with local database. i've already spent plenty of time in searching the solution but nothing is helpful.
So far I think it's a security thing that you're not allowed reading/writing to an Android SQLite database outside of the containing app's process.
But are there advanced techniques or tools that can be used to achieve this?
For instance, I want to make a web interface with a textbox where the Android app would connect to and then I can run SQL queries via said interface to read the database or to insert records into it.
I'm writing this question because I'm really stumped. Usually my search gives opposite results which is accessing a remote database with an Android app.
You will have to develop an API backend. The mobile app ( client ) will communicate with the API and do the desired operation based on the response.
It's not possible to directly connect to the app sqlite database. You can send web request and get the info you want, handle it in your app to store it in the sqlite database
You will have to add security measures, so everyone can't access your API.
So far I think it's a security thing that you're not allowed reading/writing to an Android SQLite database.
Apps can read and write to their SQLite databases. Otherwise, the database would not exist.
I want to make a web interface with a textbox where the Android app would connect to and then I can run SQL queries via said interface to read the database or to insert records into it.
You are certainly welcome to embed a Web server into your app. For example, Stetho does this to integrate with Chrome Dev Tools, offering your SQL interface among other things.
However:
Doing this for anything other than a debug build of your app is very risky, as securing a Web server is difficult enough when it is on a traditional server environment, let alone an Android device
The Web server is only accessible by whatever can reach the device via an IP address, which means it's usually only useful on WiFi (where it could be reached by other devices on the same WiFi LAN segment)
Previously, my application did not connected to AWS Database. I want to change database connection to AWS Database. But i found some trouble. I think it was same like we connect AWS Database into a Website Application. But it really different.
Mobile apps usually don't connect to a database directly but do crud operations through an api like a webservice.
So just create web_services and get data like normal https request in android app then handle received data with android apps logic
I am new in android development. Currently, I facing problem to choose a proper database software that can keep the information of a user registration details for a taxi service mobile apps.
This app require user to login and the details for both the driver and passenger will be kept in the same database. There will be a admin control the system via the web portal for this app. I am not sure whether SQLite will be the suitable database or is there any other suitable database for my project where the database can be accessed by both android phone and the web portal?
Thank you in advance.
IMO you're looking at this the wrong way.
If everything is going to be stored on a server then access data from the phone via a service.
You can keep device-local data using the normal SQLite DB. On the server side I'd probably use something else, like MySql, Postgresql, etc.