Re: Accessing Database.
Re: Accessing Database.
- Subject: Re: Accessing Database.
- From: Conrad Shultz <email@hidden>
- Date: Mon, 27 Sep 2010 14:28:28 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 9/27/10 2:00 PM, Cameron Mc Gorian wrote:
> Hi,
>
> I am very new to iPhone and iPad development.
>
> I want to know if it is possible and if there are any tutorials for
> accessing information in an SQL database, i.e one that I would
> usually access through phpmyadmin to add and edit tables etc. The
> database has already been created and is used by one of my PHP
> websites.
AFAIK, iOS does not include libmysql or any other library for talking
directly to an SQL server.(*) Even if it did, I would want to be darn
sure of my database configuration (in particular, SSL) before I open it
up to remote access.
Since you are already at least somewhat familiar with PHP, I'd recommend
writing some glue code in PHP that talks to your database server on the
client app's behalf. Luckily for you, PHP has varying levels of
built-in support for JSON, SOAP, etc., which your Cocoa app can talk
over HTTP/HTTPS via NSURLConnection and friends.
This has the other advantage of supporting some degree of database
abstraction - if you switch backends, say between MySQL and Postgres,
you only need to deal with the glue that is written in a language that
likely supports whatever RDBMS you end up using.
If you want to go all-out, define an API on your server, and you can
even keep the client code fairly insulated from schema changes and the like.
(*): Depending on the client library, its dependencies, license, etc.,
you might be able to more or less easily build and link against it in
your app. But the other issues above still IMHO argue in favor of
eschewing direct SQL connections in favor of higher level abstraction.
> Had a look through some of the Apple documentation but I am really
> confused between the Core Data and SQLite documentation and not sure
> which one I should be going through.
These are not really intended to be remote storage options. While I
believe both CAN be hacked to behave, kind-of sort-of, as such (e.g.
remote file system mounts, etc.), it's not the intended purpose.
SQLite, in particular, was designed as an embedded solution
(http://www.sqlite.org/serverless.html).
- --
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFMoQx8aOlrz5+0JdURAp8jAJ4x+NN+TM+H2el2zJCg3c1CyGPPygCfcLob
R/JZqzF3/BXw8NtqaRjXz4k=
=vxZp
-----END PGP SIGNATURE-----
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden