Is it possible to connect to SQL server in iPhone?. I want to create a new application and i want to retrieve the data from SQL Server and displayed. Previously it created using ASP.NET and SQL Server. Now my client wants to display the datas which is retrieved in SQL server data base. But the database contains the huge amount of data. So is it possible to convert the SQL Server to SQLite.(But SQLite is a light weight components). How can i do that? Can i use Web services? or i will ask to server side and convert the XML file and then i will use XML Parsing. I have no idea about it?
Please Explain Me!
Thanks.
i don't work on an iPhone app but i know that our guys that do use webservices that return pure xml with data, return that to the iphone and then parse that xml.
Wow... You are actually wondering if you can connect your iPhone-application to a SQL-server directly? Are you insane?! If you do, you need to connect with host-, username-, password-, en db-name-parameters. When people 'hack your binary converting it back to the source-code (.m-files)' they can read these parameters and create a custom connection to your db-server.
So, what you need to do is create a few scripts that parse your DB-data and return it as xml-data, so hackers won't be able to loggin into your db-server.
Related
I have an app to send data from iPhone to MySQL server and I got it with request from objective-c and php on server.
Now, I want to receive data from server by XML. I have created a php code to generate data from MySQL to XML. How can I code in objective-c to call this php code? The goal is using this XML to parse and display on iPhone (I have objective-c code to parse xml file from link on server).
Please help me if you know and used to work on that.
Use Web-servces Like XML- RPC, SOAP ,REST
To connect to a mysql database, your best bet is to use JSON/SOAP/XML/PHP or some combo of the mentioned, to talk between your database and your app..
The reason database connection directly from the device is a bad idea, is that you have to enable global external access to it for it to work. You can keep your data safer by having scripts on your server do the communication to the database.
Your server needs to expose a service of some kind (a URL the iPhone app can call).
Your app can call this URL with NSURLConnection (or lots of others).
This will return you an NSData * object.
Your app will then need to parse this raw data into XML (or JSON or a few others). You can use NSXMLParser (and lots of others) to do the parsing.
Then, you need to translate the XML into useful business objects.
I have a task at hand to create a iphone app which is required to do the following.
the app should get the data entered by the user and store it into a remote server database.
other app user can see the data in the remote database.
store login information of the user using the app so as to keep track of what information as uploaded and by who
the thing that i would like to know.
1) What SQL server database is best to accomplish the task.
2) what format is best to retrieve the information from the database.
3) how to send the data from the iphone to the remover server database to it can store the data.
i read up on SQLite and found out that this particular database is a offline which stores the data locally so it cannot be viewed by other used. i wan to use a SQL database which can be accessed remotely.
1) What SQL server database is best to accomplish the task.
For implementation on server side, you can implement any server database, it does not matter. For implementation on iphone device, you have to implement SQLite database, which will provide storage locally.
2) what format is best to retrieve the information from the database.
You can retrieve data using XML or JSON format which will be parsed in device and can be stored in SQLite database, it is the easiest way to transfer data between client and server.
3) how to send the data from the iphone to the remover server database to it can store the data.
You can send data from iphone to server in XML/JSON format or by passing parameters in POST or GET request method then this format is parsed on server side and store data on server database.
For all this, you will require to implement API on server side, which will be the interface between server and device.
I know you mention SQL specifically, but is this a requirement or just a choice based on what most other people are doing? I ask because personally I would give serious thought to using a NoSQL database (document store) like couchdb for such a task. Deploying couch means you often don't need server side application layer at all, the way you will for a SQL based solution.
You talk to couch using HTTP which is perfectly suited to the ASIHTTPRequest library for example. Fetching data is usually a GET request and storing documents is done with PUT. All the data in or out comes back as JSON so a good JSON library will make life easier.
The combination of couchdb and the 2 libraries linked above, makes developing a data driven application really, really easy.
That's how I would do it ...
If you really need to stick with SQL, then as Jignesh says, use whatever database you like and implement a suitable API in the server side language of your choice. You can transfer the data however you like although JSON would still get my vote as a relatively light protocol that remains human readable.
You can use a cloud-enabled database service, like windows azure.
First m very sorry!! for that i m asking question again related to accessing data from server.
i am new in iphone and am making a application in which require to access mysql database which is hosted on remote server,
I take a server and create our database on the server
so i have URL of the server,User Name,Password,Port Number.
I make a servlet for accessing data from the server database and generate the xml file.
I make my application and with the use of xml parser i use the data in my application.
but problem is this,
where i put my servlet which give xml file when required in my application,
On the Server?
In the Application?
i m confuse how i use servlet in my application.
If u have any reference or source code then please suggest.
Thanks,
Arun
It probably would be better to put it in the application so that your reducing the need to call the server for the details.
I'm a total noob when it comes to iPhone development and have been tasked to create a database app that can download and upload sqlite data to and from a server via http using web services. So far I already have a form for retrieving and saving data to a SQLite database and now I need some information on how I can upload the SQLite data to a server. The SQLite database will only have one table with 3 columns and about 200 rows max. I hope somebody can point me to the right direction or lead me to some sample codes.
Appreciate any help.
As you are using HTTP to get data into the iPhone, you should also use HTTP to get data out of the iPhone. That way, you can query the SQLITE database and send the data through HTTP to a remote server.
It's pretty simple to accomplish since you have all the HTTP protocol implemented in the SDK.
On the server side, you can use whatever you want: Apache+PHP, Tomcat, JBoss, ASP.NET, you name it.
I'm developing an app using UITableView driven content.
Current testing is done with local XML of size 100kb. This info should update about once every 2 months. The flow is reading pre-sorted XML -> convert to NSDictionary -> UITableView
Since parsing XML will take some work during load every time, plus table index, sorting and searching seems clumsy. So I have this idea about storing such info in a sqlite DB file
My real question is whether it's possible to download the entire sqlite DB file via http(s) instead of XML to update the info?
I don't understand the question...you have a sqlite database on a server somewhere and you want to know if it's possible to download via http? Yes, of course, just open a NSURLConnection and grab the data.
If you want to somehow transform XML from an http source to a sqlite database, well, then you'll have to write your own custom transformation code to get the proper SQL statements--there's no automatic way to do this in Cocoa.
You have a couple of options...
You can keep the stuff on the server
XML and build the database on the
fly.
You could post a text file on
the server with pre-canned insert
statements.
You could just have a
ready made DB file on the server and
download it.
Any would work... Some are more code than others.