12-29-2009 02:25 AM
Hi,
I'm a bit new to BlackBerry application development, but not new to computer programming, generally speaking.
I am working on a BlackBerry application. The application needs to be able to perform a search on a mySQL database that is hosted on my webserver. The user will be able to enter a search string into an EditField (check) on their BB, and upon hitting the "search" button, the application will search the webserver mysql database for search results and then display the search results on the BlackBerry.
I have researched a few methods for achieving this: 1) embedding a webbrowser field in the application and then loading the contents of the webpage onto the application, and 2) XML parsing (XML parsing is a topic that I am currently investigating and it is one that is foreign to me).
I'm a bit lost here--I'm not quite sure what to do. Could anyone out there give me a few tips? I completed the UI, I tested the embedded browser (which works "okay"), but I'd like to investigate the XML parsing functionality to see what it has to offer.
My questions are:
1. Can I use XML to retrieve data stored on a SQL Database?
2. Can I display XML documents on a BB?
3. Can I use the BB to interact with XML and mySQL?
If the answer is yes to any of the above questions, then my next question is how? Or, could you provide me with a few useful links?
Thanks!!!
12-29-2009 03:15 AM
Before giving answer of your questions can you explain what do you mean by "display XML documents on a BB".
12-29-2009 09:58 AM
Sure thing!
I suppose I mean parsing an XML file that is generated as a result of a mySQL database query (said mysql query is defined by the users "search" term which the user provides in the EditField.)
I would like the BB to be able to read the XML file and display the search results on the BB screen.
Maybe XML isn't the best way to go about this--perhaps there is a better way? I'm not sure.
Does that make sense?
12-29-2009 10:28 AM
You have both SAX and DOM parsers in the API - see the API docs. There is also a demo program (ships with the JDE Samples) called XMLDemo that should get you started.
12-29-2009 10:33 AM
A working example of how I think I could utilize XML in my bb app would be as follows:
1. Dictionary app on BB;
2. Definitions to words are stored in a mysql database on webserver
3. The user wants to look up the definition to the word "cup" (and enters this word in an EditField on the BB app);
4. The definition to the word "cup" is retrieved from the database on the webserver and displayed on the BB screen.
That's where I want to go with this.
12-29-2009 12:21 PM
See the HTTP demo and the aforementioned XMLDemo. These programs ship with the JDE and will give you a starting point for your project.
12-29-2009 01:06 PM
Great! Thank you for your help! Much appreciated!