Battery with alternative power supply
No, you can not safely connect a 12V power supply in parallel with a 9V battery.

The easiest way to isolate the two supplies is with two diodes. The anodes of the diodes go to your two sources. The cathodes are connected together and then to the load. Use Schottky diodes if you want to minimize the voltage drop.

There are more sophisticated schemes and this site is full of them.