How to connect Android and IOS to SQL Server - android

can someone please help, I need to develop a android app that will then be converted to IOS using Xamarin however how or what it the best way to connect to a SQL sever database that is hosted? I will have a connection string

I don't know whether direct connection from android to SQL server is possible but I used to connect via a WebServer Eg. Apache Tomcat by deploying any WebApplication that have access to database server.
The thing how it works is, we will pass parameters from android through NameValuePairs/Json types and these parameters are parsed by server application (Processing business logic) and gives back the response in String/Json format.

Related

Android using mssql server [duplicate]

I'm currently developing a Field-Service application that stores data in the local sqlite database on an android device. At some point, usually after completing the data collection rounds, the local sqlite db is to be synchronized to a remote sql server db on the server, also i need to update some local table from sql server db.
Any suggestions as to how this could be achieved or engineered as a solution? Or even better, are there alternatives to synchronizing data in such an application?
I think that the best is using a intermediary like web services or your own TCP based logic layer for your application which would connect to SQL server and execute requests of your applicatation. Don't try to connect to your SQL server directly from Android. You can write
some backend code on your server (or webservice) and then call those code methods from your android device using Http.
And also there are many themes in stackoverflow like your:
How to connect Android to a database server
Connecting android with MS SQL SERVER 2008
About how to write web services. It's a big question, and you must choose technology, there are very many libraries, frameworks and platforms that help you to simply write a web service. You must choose communicating protocol, it may be SOAP, WSDL or maybe remove calling procedure, it may be rest application. If you use java stack, there are some popular frameworks at the moment:
Apache CXF
Spring Web Services
Axis2
You can start from reading what a web service is:
http://en.wikipedia.org/wiki/Web_service
Also some links which provide example of accessing web services from android:
Step by step to access web service from android
Android and soap web services
Accessing restfull web service with android
Another and much easier approach is to use a Virtual JDBC Driver that relys on a secured three-tier architecture: your JDBC code is sent through HTTP to a remote Servlet that filters the JDBC code (configuration & security) before passing it to the MySql JDBC Driver. The result is sent you back through HTTP.
There are some free software that use this technique. Just Google "Android JDBC Driver over HTTP".
You would have to keep a middle tier online server.Which may communicate to and fro between your application and MSSQL db.May be servlet or a request handler which synchronises between the SQLite and SQL Server db.

Connection between Oracle 10g and Android

i have a database in my laptop. i want to access it from an android application. since i am new in this field, i don't have a least idea about connection android with oracle. please suggest me how to do it?
i am using oracle 10g express edition. i want to retrieve a table data to my android app from my database.
please give me the codes that i will need to perform this task.
what files do i need to perform the connection.
Thank you
You should put a rest or soap service in front of your rdbms and let your mobile app communicate with it.
For php webservice (on a windows based machine) you can setup xampp with php oci8 drivers and oracle instant client.
You can use http post or get method from your android app to transfer data from your app to your webservice and vice versa. You can execute your sql queries from your php script(webservice).
If you don't want to build up you're own web service, then you can use oracle database mobile server
http://www.oracle.com/technetwork/products/database-mobile-server/overview/index.html
You need simple java util see attach
https://docs.oracle.com/javase/tutorial/jdbc/basics/processingsqlstatements.html

How can i connect to MySql database to create a mobile application?

I have a script in java that works like a crawler and saves data in MySql DB. What i want to do is build a Mobile App(Andriod/ios) which will connect to mysql database retrieve results and just show it to the user.
What is the best approach to this ? I tried to use Flex UI with PHP as my server client but was hoping to know if there is a better solution ?
The fastest would be to make android fetch a page in XML, typically on the server and display its contents(If displaying contets is your desired result).
else
You need to implement a script on your server, your POST interacts with that script and inturn that script works with your database.
A typical scenario will be:
Java HTTP POST ~~~> PHP ~~~~> MySql.
PHP will as well help you encode the result in JSON and post it back to your client.
Try using jdbc or jtds library to connect android app with mysql
I used jdts library for connecting mssql db using android app.
http://jtds.sourceforge.net
For mysql jdbc might work

Connecting Mysql with Android

I am new for Android Development. Now I want to connect Mysql with Android Application for uploading data to the server. Please send any sample code for connecting mysql with Android.
There is no MySQL connection library for Android that I'm aware of, unless you can get the MySQL java library operational under Android.
Either way, you don't want to do this - that would mean exposing your MySQL server to the world for TCP connections. There's no way to tell what IP your device will be appearing from. Each mobile carrier has their own internet gateway for devices, and it's invariably a NAT firewall to boot. This would be require you to leave MySQL wide open to TCP connections from all IPs, a major security hole.
Instead, you should build up a web service that acts as a middleman between your app and MySQL.
You can use MySql to connect to your android application through a servlet using Apache Tomcat. You will have to put your SQL syntax into the servlet you created and in your Java insert the URI path for the servlet.
i believe you need apache tomcat to run a servlet for your sql, do you have it?
The way it should work is , you use the sql-lite database to store the data that is generated in your application.Then, when you have a fixed set of data,convert into a protocol buffer, transmit the same via web-services,depacket it and store into a mysql database at the server.
If you need to manage data in a private database, use the android.database.sqlite classes.
Not sure if android supports mysql.
Go through the Notepad Tutorial for information on connecting to sqllite
http://developer.android.com/resources/tutorials/notepad/index.html
Other than sqlite we can't connect with any other database.
Using sqlite is also not a good practice, better use web service calls.
It is because, some viewers will be having less memory phones, has we are doing the application global, we should think of these things.
For small requirements you can use sqlite.

Connect to a remote database...online database

I've been looking for a week now... I need some help connecting to a remote database... I want my app to get data out of the database and update the database...
I've tried this but i don't understand it.
Easiest way to connect a Mobile (ANDROID, iPhone, Symbian, WP7, you name it) device to a Data Base is to write a HTTP based proxy for your database.
This is:
ANDROID -> HTTP -> APPLICATION SERVER -> DATABASE
And then the other way around to get results:
DATABASE -> APPLICATION SERVER -> HTTP -> ANDROID
In this scenario, you will write a HTTP based application in your favorite language (PHP, Python, Perl, Java, .NET) and deploy it in your favorite Application Server (Apache, Tomcat, IIS) and, in that application you will publish URLs your Android app will access to send/retrieve data to your database.
I think rather than connect to a database remotely, you want to use REST services to get and post data to your remote database.  
You can create a REST service to wrap your remote database query and return via http, JSON (which I prefer) or XML.
In your android app you can do an http get or post to consume the aforementioned service
Create the database in the server
Write server side program to store and retrieve data
write the android program to access the data using HttpPost class
All the best...

Categories

Resources