Arduino Bluetooth Module not holding connection
i had similar problem ..the HC 05  used to get disconnected just after 5 seconds of connection with PC but worked fine with android. But what actually worked out for me was the AccessPort .... The module remains disconnected until the Serial port is switched on in accessport. its the same case with processing ..once the sketch runs the module gets connected automatically.Make sure you add the device to your computer and note down the outgoing and incoming ports.. :) Hope this helps

link for accessport download http://www.sudt.com/en/ap/download.htm