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
New Developer
Posts: 15
Registered: ‎10-06-2008
My Device: Not Specified

Copying database to Blackberry

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?

 

Thanks!

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Copying database to Blackberry

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:

http://www.sybase.com/products/databasemanagement/sqlanywhere/blackberry

New Developer
Posts: 15
Registered: ‎10-06-2008
My Device: Not Specified

Re: Copying database to Blackberry

I don't know if I really need SQL support as long as I can copy some data during the cable sync with the desktop...  That data could be CSV format rather than a real database, if that's the best I can do.  I have no idea how to copy the data during the sync though.
New Developer
Posts: 15
Registered: ‎10-06-2008
My Device: Not Specified

Re: Copying database to Blackberry

After looking further into SQL Anywhere, I don't think that is what I'm looking for. Maybe I can try to explain myself better. I probably shouldn't have called it a database. What I'm trying to do is to have some data that can be edited on the BB or on a desktop. This is brand new, so the data could be stored in any format (as long as its not a proprietary format), including CSV. The synchronization process would need to sync that data between the BB & the desktop. As I understand it, this requires a sync add-in right? Assuming I'm on the right path, how are sync add-ins written? I've found almost nothing about them online, so I don't know how they work at all...
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Copying database to Blackberry

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).

 

 

New Developer
Posts: 15
Registered: ‎10-06-2008
My Device: Not Specified

Re: Copying database to Blackberry

I'm really more concerned with how to write an add-in at this point, not so much how to store the data.  One way or another some data needs to be copied between my computer & BB.  I don't even know where to get started, as I've found basically no info on how to do add-ins.
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Copying database to Blackberry

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.

 

New Developer
Posts: 15
Registered: ‎10-06-2008
My Device: Not Specified

Re: Copying database to Blackberry

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.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Copying database to Blackberry

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

<JDE directory>/samples/desktop. 

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.

New Developer
Posts: 15
Registered: ‎10-06-2008
My Device: Not Specified

Re: Copying database to Blackberry

Thanks for the tips.  I've been using Eclipse instead of the JDE, but I'll find those samples.