11-19-2008 11:18 AM
I have a database application running on my computer that I'd like to be able to move to my BlackBerry. (The database is fairly small.) To do that I'd need to copy the database to the device during its synchronization. (As an add-in I guess?) It's a MySQL database.
I don't even know where to get started on this. Has anyone done something like this? Is this even possible? Any tips on getting started?
11-19-2008 12:08 PM
There are, of course, many hurdles you will have to jump, but we will start off with the one in your subject, the database.
There is (currently) no native SQL support on the device. SQL Lite has been announced, but I've not seen any dates, or any idea of the functionality.
If you wish to take your database over as a database, then I think there is ony one option, Sybase's SQL Anywhere. See:
11-19-2008 12:20 PM
11-19-2008 03:06 PM
11-19-2008 05:24 PM
Check out the RIM classes like Arrays- they have some sorting and binsearch classes that
I've been using. I posted some lists earlier.
I was going to respond earlier but got tired of debating the DB on phone people.
Someone else asked about random file access, if you wanted to put a java DB on a phone and not use
the persistent storage, what kind of code would you use?
In terms of IO format, most people have suggested XML but I've found so far that the time needed to
parse it rivals the download time ( obviously with wifi it would be an even larger fraction unless
CPU;s have gotten proportinally faster than on my 7130) and both are significant ( although sometimes
connection latency is a large part too). So, anything like CSV that is more terse and easier to parse would
be worth considering if you can live with a fixed or single header based format ( as I am seriously considering it).
Personally I've found it easier to use space delimiters and encode the multi-word fields.
I actually feel a bit dumb for hopping on the XML bandwagon, as the original data I used to populate the DB on the server was in line oriented format and I've encountered at least one error that may be a quirk of the parser
( hard to tell but not an issue with a line format).
11-19-2008 05:29 PM
11-19-2008 05:35 PM
Add-in to what? I'm not familiar with a tethered synchronization process as I still haven't installed
the BB utilities on my win 2k machine ( afraid I won't be able to recover from failure) and my USB
port is on the back. If you have a server under your control you can do most of this stuff OTA.
11-19-2008 05:41 PM
I don't have a server under my control.
The add ins I'm referring to can be added in the desktop manager. For example, iTunes has an add in that syncs music to your phone. I guess they somehow allow BB apps to sync some data to the desktop when syncing via the desktop manager.
11-19-2008 07:37 PM
I think you have at least three options:
1) There are a number of add-ons like you are trying to write, that hook into the Desktop Manager and provide upload/download facilities. In fact, I believe a sample is provided with the JDE - look in
There is information on them in the Developer Guide
2) You can even do this sort of thing using a USB Client, I think there is a sample of that included with the JDE too.
3) Finally of course, you could stick the data you want on the SDCard and have your application pick it up from there.
I think there are advantages and disadvantages with all these approaches, sorry I've never really looked at them so I'm not able to give you advice on which to choose. (3) seems to be to be the simplest though.
Re the format of the data, remember that the BB is not a PC, so brief and easy to parse data is preferable to verbose and slow. I like XML, because of its extensibility and the parser (I only use the SAX version) seems to work quite well. However it is not necessarily that fast or lightweight. Note however that all current devices are significantly faster than a 7130 (Moore's law applies to smart phones as sell, and the 7130 is nearly 3 years old I think).
Regarding marchywka comments, until recently I had a Win 2K machine, with the USB connection round the back, and I have a Server in the next cubicle. However I still much prefer Desktop Install to OTA - a USB extension cable solved the round the back problem and Desktop Manager worked fine on Win 2K. I no longer have a Win 2K machine because it could not cope with the later level JDEs - 1 GB memory really is not enough. But I digress. The point here is that wanting to do this via the Desktop Manager is fine.
Hope this helps.