Remote MS SQL or MySQL Database on iOS - iphone

I currently have a website that uses MS SQL and I am interested in creating an iOS client for that website. I would the app to connect to a remote SQL database that is hosted on my website and then I could pull information from that database and display it locally on the device. I would like to also publish information to the database. I am open to use MySQL.
Is this possible and if so does anyone know of any good tutorials that I could check out?

I'd highly recommend placing a thin web layer between your database and your iOS client. You don't want iOS apps connecting directly to your database (unless this is for your own personal use for limited to a handful of people you really trust).
You could write the web layer in PHP (or whatever you fancy). At that point you can use HTTP and JSON between your iOS app and your database.

Put a web service between the phone and the DB.

There are two options :
You can develop webservices/scripts or whatever server side solution that will make your database talk "publicly"
Use a third-party library (like this) that will make your app communicate with the MySQL database.

Related

How to connect a C# Windows mobile 6.5 app to a Postgres database?

I'm developing an application for Windows Mobile 6.5 that needs to get and send data from a Postgres database within the network of the app.
I've googled it and read every page on the matter but haven't been able to find a solution.
The npgsql driver doesn't work on this sdk.
Much like for Android or iOS, I'd recommend that you build an intermediary web service that's provided by a server on the Internet that the phones talk to instead of talking directly to the database. The web service would accept REST+JSON, REST+XML, XML-RPC, SOAP, or whatever your preferred web service procotol is from the phone clients. It'd act on the requests from the phones, doing whatever is needed in the database to satisfy the request, and return any result via the web service protocol.
This means your individual phones don't need connections direct to PostgreSQL - a good thing, since phone network connections are flakey and the retry/re-establish logic can be hard to get right. You'd land up with lots of dangling connections to the Pg server. You're much better off with a stateless protocol like HTTP to talk to a web service that then does the real work.
Choose whatever web service protocol is easiest to work with on Windows Phone 6.5 and implement it using your preferred back-end server. In your case I imagine that's likely to be .NET on IIS.
Depending on the app, you might already have a web service protocol. If you have a modern web page version then it's fairly likely to use JavaScript with REST+JSON to call server endpoints, in which case you may just be able to extend and re-use those for the phone app.

Database in Phonegap Blackberry

I am new to phonegap - blackberry. I am using Apache ANT, BBWP. I want to connect the database. I refer http://docs.phonegap.com/phonegap_storage_storage.md.html but i cant understand fully. Can any one send me step by step to connect database and its operations. I have some more doubts, How to access access phone music player, and how to read read phone memory / SD card.
Thanks in advance.
As far as I can see, this storage tutorial is about creating your own SQLLite like database. To connect to an existing database on a server, web services with JSON would be a way.
http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-quot-I-quot-would-call-a-web-service-from-a-WebWorks-App/td-p/519745/highlight/false

DB to run on OS X server that will sync nicely with Core Data on iOS?

I am trying to plan out a few iOS/server apps for internal use. On the iOS side I'll use Core Data, but I'm not so sure what many people do on the server side. I will be running a Mac Mini with OS X Server 10.6.X. This app will need to sync when the iOS device is on the internal WiFi as well as over 3G. Some of this data will need to be accessed by the company's external web site which is written in PHP, as well as by native apps on iMacs internally. Should I just use a MySQL db on the server, and expose a web service, or is there a better way by using Core Data on the server that would make syncing the iOS device easier? The data is not too relationally complex. I'm thinking tblClient 1->M tblJob 1->M tblImage/Drawing.
In most cases, the server side doesn't matter because your communicating with URLs and some standard data format like JSON.
You can connect to a remote Core Data store but it doesn't handle multiple access so there's seldom much point to doing so. You could write your own server that uses Core Data but usually its quicker and easier to use a preexisting package dedicated to server work.
My advice is to go with the server that is quickest and easiest for you to implement and maintain with the knowledge and tools you have on hand. It's easier to adapt the client side Core Data to inputs from the server than it is to attempt to integrate Core Data directly into the server.

How do I write a desktop application that syncs with the iPhone?

For example, how would I write a program like senuti? Are there any libraries I can use for this? It would be ideal if I could do this in Python or .Net, but I'm open to other things as well.
There are three things you can do:
Add some code to your iPhone application which acts as some kind of server (http, SMB, etc). Then your mac/windows full client application can connect to this server over wifi. This is safe and reliable, but unfortunately the app will have to be running on the iPhone at the time of sync.
Sync to the "cloud". EG: Have your iPhone app save some data to a web server on the internet (you could use amazon EC2, windows Azure, or even just a PHP script running on a cheap hosting account), and then have your windows/mac client also connect to this web server to retrieve the data. This is the most user-friendly, but it requires you to pay for the hosting of the web server, and will be unsuitable for large amounts of data
Violate the EULA and try to reverse engineer the way iTunes communicates with the iPhone.
This is how senuti works, but I wouldn't recommend it, as they're constantly having to play catchup with apple changing the format underneath them, and they are probably exposed to some kind of legal action, if apple ever bothered to sue them.
i believe Version 3.0 will resolve this as it allows you to program apps to the USB interface. check out some of the documentation for that in the External Accessory framework.
it would still require the app to be open, so essentially would mean two syncs (or more if you have multiple apps)
There is no legal / official way of doing this. Creating a program that would sync with an iPhone would violate the EULA you agree to when using the iPhone and iTunes.
Not only is it illegal, but it's also impossible to do this reliably. Apple could break the method at any time without any notice, and it would pretty much be a cat-and-mouse game.
I only know of one application that something of the kind, and it is the iToner application which synchronizes ringtones.

Can the iPhone only use an SQLite database?

Can the iPhone use other databases besides SQLite, like MySQL?
The iPhone can only use SQLite as a database, directly on the device. This means there is no MySQL server inside the iPhone. But you can, and are free to have (your own) MySQL Back-end server, to which iPhone applications connect to. But Apple doesn't provide the server, so you have to pay the maintenance costs
Not true any more!
The Raima RDM Embedded database SDK will also work on the iPhone. It's cool because it supports the network and relational models, and you can do things like having direct pointers to records for faster access.
They have an official port coming, but their version for Mac works in the iPhone Simulator.
raima.com/iphone
SQLite is installed on all iPhones. Theoretically, you can run other databases but since you cannot start other processes, you cannot run MySQL -- MySQL requires a separate process (the mysqld daemon).