Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

XML/mySQL/PHP--Searching/Retrieving Data

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!!!

Developer
Posts: 193
Registered: ‎04-27-2009
My Device: Not Specified

Re: XML/mySQL/PHP--Searching/Retrieving Data

Before giving answer of your questions can you explain what do you mean by "display XML documents on a BB".

Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: XML/mySQL/PHP--Searching/Retrieving Data

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?

 

 

 

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: XML/mySQL/PHP--Searching/Retrieving Data

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.

 

Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: XML/mySQL/PHP--Searching/Retrieving Data

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.

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: XML/mySQL/PHP--Searching/Retrieving Data

See the HTTP demo and the aforementioned XMLDemo. These programs ship with the JDE and will give you a starting point for your project.

 

 

 

Highlighted
Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: XML/mySQL/PHP--Searching/Retrieving Data

Great!  Thank you for your help!  Much appreciated!