On my old iPhone, I had Swaptunes perfectly set up and able to switch back and forth.
On my new 3G, version 4.2.1 though, it's giving me a lot of problems. It seems that it just won't swap libraries; it keeps the same library when I click to swap. For example, normally when you click the app and you still have not synced any music, the second library is supposed to be empty right? Well, when I click it, the second library is the exact same songs as the first one. I don't even think it is swapping at all, because when I play a song in one library, "swap," then go back, the song still plays where it left off..
If you wanted to use AppTap to put Installer.app on your phone, there is an app called SwapTunes that will let you sync with 2 computers and switch your library back and forth between them. I would assume it renames a directory so your iPhone can't find your music and reports the library as blank so your phone won't have its contents erased by a second itunes library.