Multiple databases with Funambol Server

Prerequisites

Running Funambol server, Evolution, SyncEvolution

Beneath the default calendar and contact 'Personal' from EvolutionI I'm using another calendar called 'Business'.

To synchronize all calendars with my HTC mobile phone, I'm using the Funambol server and on my HTC the Android App Funambol Sync.

I'm using Linux Debian. Preparing Funambol

Log into the Funambol Admin Tool and make the new calendar known to Funambol:

Go to

localhost -> Modules -> foundation -> FunambolFoundationConnector -> PIM Calendar SyncSource

and add a new SyncSource while right-click on PIM Calendar SyncSource. Call the calendar calbusiness and choose as Default type vCalendar. The Source URI is called: calbusiness.

Save the settings and go to PIM Contact SyncSource and add a new source similar as done before with the PIM Calendar SyncSource. Give the name business and as Default type VCard. The Source URI is called business. Save the settings.

Do the same for a third calendar for the mobile phone: PIM Calendar SyncSource: calmobile and PIM Contact SyncSource: mobile

In the 'Users' section add three more users: personal, bu and htc. You can choose also other names! Take care to use the right names in the configuration!

Check the Server URI in the Server settings. Mine looks lik this: http://192.168.178.2:8080/funambol/ds Please replace 'localhost' with the IP address of your server!

We're done with the configuration of the Funambol server.

SyncEvolution

After the Installation of SyncEvolution, a new directory can be found in the home directory:

~/.config/syncevolution

And below this directory a config.ini and a 'default' directory. Below this directory 'default' we find a config.ini and the 'peers' and 'source' directories. Below the 'peers' directory we see another directory 'funambol'. This is used by the default user called 'funambol'. We're using this one for synchronizing the default Evolution contacts and calendar, 'Personal'.

For the first we don't touch or edit any of these files or directories. We will modify them directly with syncevolution:

syncevolution --configure \
                 syncURL=http://192.168.178.2:8080/funambol/ds \
                 username=bu \
                 password=secret \
                 calbusiness/database=Business \
                 calbusiness/uri=calbusiness \
                 calbusiness/syncFormat=text/calendar \
                 calbusiness/forceSyncFormat=1 \
                 business/database=Business \
                 business/uri=business \
                 bu calbusiness business

'calbusiness' is our business calendar called in Evolution 'Business'. 'business' ist our business addressbook called in Evolution 'Business'.

After exectution we find beneath the 'funambol' directory another one called 'business'. This is used by the user 'bu' for our business calendar and contacts:

~/.config/syncevolution/default/peers$

We change to this directory: cd business The config.ini there sould contain the following:

syncURL = http://192.168.178.2:8080/funambol/ds
username
= bu
password = secret

The 'peers' directory in the bu directory is obsolete.

Now we have a closer look at the sources directory:

~/.config/syncevolution/default/peers/business/sources$

Here we find the entries 'calendar' with its config.ini. Because we want the bu user only to synchronize the business calendar and contacts, the synchronization for the default (Personal) calendar 'calendar' and default addressbook 'addressbook' are disabled:

sync = disabled

More interesting are our Business calendar and contact in this case.

We check the config.ini of the calbusiness (our Business calendar):

sync = two-way
uri = calccc
syncFormat = text/calendar
forceSyncFormat = 1

and also the config.ini of the business (our Business addressbook):

sync = two-way
uri = business

Now we change to the sources directory within the default directory:

~/.config/syncevolution/default/sources$

Here we find for every SyncSource the configuration. A little exception are the default addressbook and the default calendar. Because these are default their configuration is not given in their configuration files here!

We have a look at the business configuration:

First of the Business addressbook:

~/.config/syncevolution/default/sources/business$

The config.ini here should look like this:

backend = addressbook
database = Business
Where 'Business' is the name of the Evolution contact folder.

Second the Business calendar:

~/.config/syncevolution/default/sources/calbusiness$

The config file should look like this:

backend = calendar
database = Business
databaseFormat = calendar

We're done with the configuration of our business account.

Now we do a first sync:

Only the addressbook:

syncevolution bu business

Only the calendar:

syncevolution bu calbusiness

Or both together:

syncevolution bu business calbusiness

When we log into the Funambol Demo Client (192.168.178.28080/webdemo) with the user 'bu' then we should see the synchronized data!

Now we can log in with the mobile phone app also with the user 'bu' and synchronize this 'Business' calendar.

But this way we can synchronise only one calendar. When we synchronize the 'Personal' calendar and contacts with the same user, the other data is replaced.

Take care with the synchronization not to mess up with your data! Make sure you have a backup of your data! It can easily happen that you overwrite your data in Evolution with the wrong data from Funambol! Please read also the documentation in the Wiki to synchronization methods (two-way, refresh-from-server, refresh-from-client, etc.) and the syncevolution usage.

Make sure that the right user name is entered in the config.ini:

~/.config/syncevolution/default/peers/funambol$

syncURL = http://192.168.178.2:8080/funambol/ds
username
= personal
password = secret

syncevolution funambol addressbook calendar

Merging Two Calendars

Idea

Merge the 'Personal' and 'Business' calendars into one temporarily calendar called 'HTC'.

First we export the 'Business' calendar:

syncevolution --export sync/business.ics business calbusiness

Second we export the 'Personal' calendar:

syncevolution --export sync/personal.ics funambol calbusiness

Now we import this two calendars into the Evolution temporarily calendar 'HTC':

syncevolution --import sync/buisiness.ics backend=evolution-calendar database=HTC

syncevolution --import sync/personal.ics backend=evolution-calendar database=HTC

Please read carefully also the syncevolution usage!

Now we have all our personal and business calendar entries in the Evolution 'HTC' calendar. From here we can export this calendar following the steps explained before with the 'business' calendar but for the htc calendar now:

syncevolution --configure \
                 syncURL=http://192.168.178.2:8080/funambol/ds \
                 username=htc \
                 password=secret \
                 calbusiness/database=HTC \
                 calbusiness/uri=calmobile \
                 calbusiness/syncFormat=text/calendar \
                 calbusiness/forceSyncFormat=1 \
                 business/database=HTC \
                 business/uri=mobile \
                 htc calmobile mobile

In the new htc directory check the config.ini files and you're done for the sync of the merged calendar:

syncevolution htc calmobile

Log in with the phone with the new user htc and synchronize the calendar.