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

Web and WebWorks Development

Reply
New Developer
Posts: 5
Registered: ‎02-16-2012
My Device: Developer
My Carrier: Virgin Mobile UK, Vodafone UK

remote mysql connection and data retrieval

[ Edited ]

Hi,

 

I am looking into developing an application that needs to connect to a remote mysql server and retrieve data to my playbook.  Basically the application needs to:

 

First time

1) Connect to my remote mysql server

2) copy the entire contents of remote mysql database to local storage (i assume this html5 database)?

3) display data from local storage

 

After first run and consequent runs

1) Connect to my remote mysql server

2) only copy new updated data from remote mysql server

3) display data from local storage

 

 

Can anyone please advise the easiest way to achieve 1 & 2 easily and keeping data not loosing after exit or reboot?

 

Thanks

 

Developer
Posts: 62
Registered: ‎04-29-2010
My Device: N/A

Re: remote mysql connection and data retrieval

Well you could have a web service that sits on a server that returns the contents of your tables. The app would then make an xmlhttprequst to this web service and grab the data. You can then store this in localStorage and it should remain when you exit  the app or reboot.

 

As for grabbing only updated data, you could pass this web service some parameters when you make the xmlhttprequest, maybe the date and time from when you last sent the request (you could store this in localStorage also). The web service could then filter the data based on this datetime parameter.

 

New Developer
Posts: 5
Registered: ‎02-16-2012
My Device: Developer
My Carrier: Virgin Mobile UK, Vodafone UK

Re: remote mysql connection and data retrieval

aah, i see what you mean, sounds good, are there any limitations in using html5 database on playbook for this feature or is localstorage better, sorry, still learning?

 

 

Thanks

Developer
Posts: 62
Registered: ‎04-29-2010
My Device: N/A

Re: remote mysql connection and data retrieval

[ Edited ]

It really is up to you. Have a look on the web for which suits your needs better.

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: remote mysql connection and data retrieval

>> are there any limitations in using html5 database on playbook for this feature or is localstorage better, sorry, still learning?

 

It depends on what type of data your are saving. Would it benefit from a relational database, or is the overhead of maintaining a DB schema and the associated insert/update/delete services unecessary?  If its just some name-value pairs, perhaps using JSON to transmit your data, you can simply stringify the whole object and save that directly to localStorage.

 

 

Performance tip: try to keep the number of get / set calls to localStorage OR WebDB to a minimum.  It is a syncronous operation and can introduce thread blocking if you have many calls (e.g. one waits for another to finish).

 


Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
New Developer
Posts: 5
Registered: ‎02-16-2012
My Device: Developer
My Carrier: Virgin Mobile UK, Vodafone UK

Re: remote mysql connection and data retrieval

Thanks all, appreciated for the tips & help.

New Contributor
Posts: 6
Registered: ‎06-19-2012
My Device: developer
My Carrier: na

Re: remote mysql connection and data retrieval

aint there any way the blackberry phone could dircectly connect to the Mysql database....like jdbc drivers or java.sql package in there for blackberry development.....

 

 

 

 

Regular Contributor
Posts: 81
Registered: ‎03-09-2012
My Device: PlayBook & Bold 9780
My Carrier: n/a

Re: remote mysql connection and data retrieval

From an architectural and security viewpoint that is far from advisable.
New Contributor
Posts: 6
Registered: ‎06-19-2012
My Device: developer
My Carrier: na

Re: remote mysql connection and data retrieval

okay..so what could be done....a web servive...but how wil the web be made....

 

i am thinking on a jsp code that will take data from database and convert to json and send it to blackberry device...and vice versa take data from bb phone in jason and convert and give it to database server...

 

is it possible and feasible...

 

what are the other options...

Highlighted
Regular Contributor
Posts: 81
Registered: ‎03-09-2012
My Device: PlayBook & Bold 9780
My Carrier: n/a

Re: remote mysql connection and data retrieval

[ Edited ]

http://en.wikipedia.org/wiki/Web_service

http://www.slideshare.net/rmaclean/json-and-rest

http://en.wikipedia.org/wiki/Representational_state_transfer

 

> is it possible and feasible...

Sure, the whole enterprise world is doing it.

 

> what are the other options...

Too many to enumerate, depends on what you're comfortable with and what technology is already at your disposal.