I want to develop a basic form application which records datas into a sql server. However, it is commercial work so i need to use an application server for security reasons. I searched and discovered that android can connect to a sql server via a open source library but i'm not sure how to use an application server with these?
You should write a webservice layer on you application sever and consume these on the android client.
Connecting to DB directly is not advisable
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 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)
I'm studying android and I have a question. How to transfer data between app and client ? which DBMS I can use ? and how to make my laptop become server ? all of this I just want to practice. Thanks for all advice !
you need a server program which service requests via web services. So this is the server program which has access to DB and choosing DBMS does not depends on android app. when your server program reads data from DB, it'll send them to android app in JSON or XML format (most common formats).
you can setup a local network in your laptop and connect you cell phone to that. but for testing purpose you can use emulator in your laptop.
Am developing Android program. Now I need to access MSSQL2008R2 remotely from one computer(client) to another computer(server).
Which is the best way to connect?
Such as, JDBC Driver, Web Service
If you developing the the mobile application for any OS like Android, iPhone, Blackberry etc. then you should use web service to get data from server.
Reason to use Web service.
If you use web services method to get the data from database server remain same and need to write once in webservice but in case of JDBC its only for java, In other cases you need to search other ways to connect to database server.
We are interested in purchasing a server for storing a MySQL database that is used by an Android application. Just to understand, does the server only need to support MySQL, or are other requirements for a server for mobile use?
Your Android application would probably not work directly with a remote MySQL database.
In general, you would use write a web service API to act as middleware, communicating with your Android application and the database. Your Android application would make HTTP requests to the web service, which would in turn perform CRUD on your database. In this case, your server would need both a web server (with support for Java or PHP or whatever language you choose to use for the web service) and a database server. See How to have Android app work with MySQL online database?
To access the database "directly" (like it was local), this could help: MySql remote database manipulation in Android
But you might need some additional server functionality, at least in the future. Then you could use a server which also offers PHP. PHP + MySQL are usually offered together, it's very common/popular and it's cheap. Since you don't seem to have any special requirements for the server functionality, PHP is probably suitable.