Tech Note 41: Using foSync to talk to ODBC Servers, without a Conduit

September 29, 2005

submitted by: Fundamental Objects


Contents:

    Introduction
    A Small, working NSBasic Example
    Related Links

Introduction:

SYNCHRONIZATION WITH NSBASIC

foSync™ is a standalone toolset, that makes it easier to move data that has been captured in a NSBasic file, back and forth to;

   a corporate database;
    or,
   a web-hosted database
    or,
   a location on your LAN or web server.

This "data" can be Pocket PC CDB data, Palm PDB data or even complete physical files, such as PPC executables or Palm PRC files.
 
foSync

foSync is an enterprise-level tool; featuring security, speed (data is compressed) and, flexibility -- no conduits are required.

How it Works

foSync is a standalone executable that can be called from NSBasic. A configuration file is set up that determines which fields of data on the PDA side are transferred to (and optionally, back from) the server. A Windows service is run on the server to accept data from PDAs being synchronized. This service handles multiple instances simultaneously.

The base foSync product will transfer ALL of the fields in the associated PDA database to the server. Users will be able to have records deleted, added or changed, depending upon how your application wishes them to be marked. Data can be moved wirelessly to the server, or handled in disconnected manner, being synced when next connected online to the server. All that is really required is an open IP connection.

Data that is moved to the server is encrypted and compressed -- which in and of itself is really worth using foSync alone. foSync has demonstrated customer sync times up to 5x faster than XTND Connect, a widely used and much more expensive alternative.


Moving files

If you receive a physical file from the server as part of your sync, the file will be dropped into a specified folder on the PDA. If that folder does not exist -- the user will be prompted before creating it. The user can choose a different folder and that folder then becomes their individual default.

   

A Small, working NSBasic Example:

 
  This is a simple NSBasic application that you can download to try. It models a wireless sync situation.

This example allows the user to enter a userid and password, (which can be used to access an online site to see the changes immediately). You can also enter a block of text to move to the server. Tapping the Sync! button will transfer your data to a web-based database, which you can then visit to confirm this action.

Usage

This example can be downloaded and run yourself from here (http://www.fo.com/downloads/nsb-demo.zip).

Download and place this example onto a PalmOS 4+ PDA. Then, on the PDA with an open IP connection to the internet -- enter YOUR userid and password (anything is fine, as long as you remember it for the next step), and a portion of text that you want to send to the server. Now tap Sync!

  You can then see the entry that you've made into a web database. Log into the NSBasic sample page at FO (http://www.fo.com/nsdemo.asp), using the UserID and Password that you entered into the application, and you will see a record with your data on it along with some of the basic synchronization messages that this toolset provides for adminstration.
 

What would you use foSync for?

The tool allows NSBasic to easily interoperate with ODBC-compliant databases, such as SQL Server, Oracle and MS Access. You can use the combination to update records on a web-based database; retrieve extended information -- such as error codes and text, where the error information can be updated centrally over time -- or even to move files back and forth to the server.
 

How Would You Use foSync?

To use this tool, you would define which fields within your PDA database should be moved back (and forth) to the server when the sync occurs. Newly added rows are ADDED to the server database and DELETED rows removed.

Files on the PDA
There are 4 files required on the PDA to sync (and 2 are created during the processing itself).
They are:
  
Created Filename Purpose
  NSSyncDemo.prc The NSBasic demo itself.
  NSSync.prc "fo"Sync for NSBasic.
  FOZlib.prc Data compression library.
  SyncConfig.pdb Setup parms for foSync.
Created SyncStatus.pdb Control file to start foSync with.
Created nsf1.pdb The actual data to move.


        Files shown in Launcher


API
The "API" to call foSync is fairly simple.
>From your NSBasic application, call the foSync application in code, or from a "Sync" button. For Example, first create the SyncStatus pdb, to associate foSync to your application:

If rc <> 0 Then
    MsgBox str(rc) + " on SyncStatus create."
Else
    rc=DBOPEN(CustomerDB,"SyncStatus",0)
    rc=DbInsert(CustomerDb, "Y", "NSSyncDemo","","")
    rc=DbClose(CustomerDb)
End If


Place the data to be synchronized into nsf1.pdb.
Then start the sync.


Sub RunSync()

   Chain 0,"NSSync"

End Sub

The demo that you can request below requires no coding on
your part, as it is a self contained NSBasic application.

When you begin the sync process -- a separate screen (right) will be displayed as the files are syncronized with the server.

Once the sync has completed, you can either return control to your program (to check the status) or exit.

A sync in Process


More sophistication, such as conditionally moving rows, based upon their contents -- or resolving complex user key situations, can be customized for individual situations as well.

Related Links:

Request the NSBasic foSync demo
foSync


Updated October 17, 2005, Fundamental Objects, Inc.