tags:

views:

27

answers:

2

What would be the preferred method of pulling content from a remote database?

I don't think that I would want to pull directly from the database for a number of reasons. (Such as easily being able to change where it is fetching the info from and a current lack of access from outside the server.)

I've been thinking of using HTTP as a proxy to the database basically just using some PHP to display raw text from the database and then grabbing the page and dumping it to a string for displaying.

I'm not exactly sure how I would go about doing that though. (Sockets?)

Right now I am building it around a blog/news type system. Though the content would expand in the future.

A: 

You might look at using AJAX (I recommend JSON instead of XML though). This is the technology underlying Google Maps.

Jay
I think you miss interpreted the question. :X This NEEDS to be done in C++ on the client side. I have no problems serving up the content if I am going with the http route.Unless I am missing something here ofcourse.
DaFox
AJAX works just fine with C++. Many people like AJAX because it provides some structure to the data that raw text does not.
Jay
A: 

I've got a similar problem at the moment, and the approach I'm taking is to communicate from the client app with a database via a SOAP web service.

The beauty of this approach is that on the client side the networking involved consists of a standard HTTP request. Most platforms these days include an API to perform basic HTTP client functions. You'll then also need an XML or JSON parser to parse the returned SOAP data, but they're also readily available.

As a concrete example, a little about my particular project: It's an iPhone app communicating with an Oracle database. I use a web service to read data from the database and send the data to the app formatted in XML using SOAP. The app can use Apple's NSURLConnection API to perform the necessary HTTP request. The XML is then parsed using the NSXMLParser API.

While the above are pretty iPhone-specific (and are Objective-C based) I think the general message still applies - there's tools out there that will do most of the work for you. I can't think of an example of an HTTP API offhand, but for the XML parsing part of the equation there's Xerces, TinyXML, Expat...

HTH!

Mac