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: 6
Registered: ‎05-10-2009
My Device: Not Specified

How to sync between desktop application database on PC and blackberry?

[ Edited ]
am devloping 2 apps, one for blackberry and  one for pc which I need to sync data between device app and desktop ms sql databse when cradled:

 

sync is triggered by 3 ways:

1. automatically when cradled (how to detect when a device is cradled?)

2. by users on desktop app

3. by users on blackberry app

 

the sync process should be done on pc and can be triigered from blackberry, right?

 

can you tell me where I can find a similar example or doc? I read the built-in otasyncdemo example on JDE, but seems not the right solution.

 

I read BlackBerry Application Developer Guide
Volume 2: Advanced Topics, page num 101, does that meet our requirements? 

 

any help or suggestions would be appreciated. thank you in advance.

 

 

Message Edited by htphuoc on 05-11-2009 01:05 AM
Message Edited by htphuoc on 05-11-2009 01:06 AM
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

You can write application which connects to comp using socket/http and sync the data in your specified format.

 

1. You can write a background application and schedule your sync process.

2. When used try it on PC, you need to intimate the BB device in some event format so that BB device can call the sync process.

3. When user clicks on sync button and call teh sync process.


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

As a general comment, and where BBDeveloper is going, is that people seem to be moving away from syncing at the desktop and thus requiring the user to 'plug-in', instead things seem to be being done via wireless connections.  This is particularly useful when the data you want is from a shared (corporate) database held centrally rather than on the User's PC.

 

However here are some additional answers to your questions. 

 

"(how to detect when a device is cradled?)"

See USB PortListener

 

"the sync process should be done on pc and can be triggered from blackberry, right?"

 I don't that there is a right or wrong answer to this - it depends on how you design it to work.

 

"can you tell me where I can find a similar example or doc?"

See the usbdemo supplied with the JDE.  There are number of Threads related to this demo on this forum what will provide useful information about this too, so search around.  For example:


USB Connection to the Desktop
http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=9819

 

New Developer
Posts: 6
Registered: ‎05-10-2009
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

[ Edited ]

thank you for your replies

 

 I need to sync via wired connection only, for wireless, we used web service already.

 

 

what you meant is that the best approach is usb read and write?

if we use usb reading approach, can we read the data which was saved using blackberry persistent model?
Thank you a lot
 
Message Edited by htphuoc on 05-11-2009 10:53 PM
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

I'm not sure I understand why you are asking this question:

"if we use usb reading approach, can we read the data which was saved using blackberry persistent model?"

 

If you put the data into persistent store, why would you not be able to get it out?

 

Since persistent store is an Object database, you will need to have access to the Objects used in the Persistent Store, as you will need to serialize them for transfer.  There is no Reflection or Serialization functions available, so you are going to have to write this code yourself.

 

Does this answer the question?

New Developer
Posts: 6
Registered: ‎05-10-2009
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

[ Edited ]

it is better device should write to and read from xml files? then those can be read from pc via usb connection? besides, I need the two apps can talk to each other, for example:

 

the sync tool on pc can be triggered by both apps: the app located on device and the app on pc

 

Thank for your precious suggestions

 

 

 

Message Edited by htphuoc on 05-12-2009 10:44 PM
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

OK, I mis-understood.

 

What you are suggesting is that this 'sync' application could just use a common format on both ends.  I think that is a good idea.  Given that you are doing the wireless processing via XML, then I think XML would be perfect.

 

Also, I think that in an earlier response I mentioned USBPortListener to determine when the device is tethered.  Sorry, that is wrong.  I think you should use SystemListener2.

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to sync between desktop application database on PC and blackberry?

if you connect a device to a PC running a device manager it routes its traffic over your PC. you can just use the wireless sync process.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

Simon, Just out of interest, and potentially off topic, but here goes...  I know this works for BES devices, where the PC has a 'route' to the BES.  But does it work for non BES devices, or a PC which is not in to the corporate LAN (i.e. doesn't have connection to the BES)
New Developer
Posts: 6
Registered: ‎05-10-2009
My Device: Not Specified

Re: How to sync between desktop application database on PC and blackberry?

Thank you for your answers

 

because I am new to Blackberry and java

 

I am not familar with BES, what is it?

 

finally, we can trigger the tool on pc from blackberry via wired connection , right?