Removing iPhone or iPod Touch Calendar that wont disappear

I had a problem with my iPhone, i had previously added my google calendars to sync with iCal on the mac so they synced with my iPhone. THis was great except i couldn’t add things to them from the iPhone.

When Google allowed exchange access i just set that up and used it, problem was that I could no longer get rid of the old ones. I even set iTunes to sync NO calendars and deleted it all, and still i had a couple of these old calendars hanging about.
I figured since I had jail broken my iPhone i should be able to look around the filesystem and see what the problem was. Fairly quickly i found in the user ‘mobile’ home dir the files Library/Calendar/Calendar.sqlitedb (fullpath /private/var/mobile/Library/Calendar/Calendar.sqlitedb ) .
I grabbed an sqllite editor from http://sourceforge.net/projects/sqlitebrowser/ , copied the file over to my local Linux machine.
Opened the file in sqllite editor, went to Browse Data’ then changed the dropdown to ‘Calendar’. Deleted the offending Calendars, saved and re-uploaded.
Make sure you change the ownership so the mobile user can write to it!
Hermes:/User/Library/Calendar root# chown mobile.mobile Calendar.sqlitedb

Now before you get cocky, make a backup before you overwrite the original eh? Just in case you bugger things up!

Command history

wishes@tulip:~$ scp root@192.168.0.28:/User/Library/Calendar/Calendar.sqlitedb .
root@192.168.0.28’s password:
Calendar.sqlitedb 100% 716KB 716.0KB/s 00:01
wishes@tulip:~$ tar zvxf sqlitebrowser-1.3-i386.tar.gz
sqlitebrowser
wishes@tulip:~$ ./sqlitebrowser
wishes@tulip:~$ scp Calendar.sqlitedb root@192.168.0.28:/User/Library/Calendar/Calendar.sqlitedb-new
root@192.168.0.28’s password:
Calendar.sqlitedb 100% 552KB 552.0KB/s 00:00
wishes@tulip:~$ ssh root@192.168.0.28
root@192.168.0.28’s password:
Hermes:~ root# cd /User/Library/Calendar/
Hermes:/User/Library/Calendar root# ls
Calendar.sqlitedb Calendar.sqlitedb-new
Hermes:/User/Library/Calendar root# mv Calendar.sqlitedb Calendar.sqlitedb-old
Hermes:/User/Library/Calendar root# mv Calendar.sqlitedb-new Calendar.sqlitedb
Hermes:/User/Library/Calendar root# chown mobile.mobile Calendar.sqlitedb
Hermes:/User/Library/Calendar root# logout
Connection to 192.168.0.28 closed.