What is the general solution to 12x = 9 (mod n)? I know how to solve specific cases but can't find a way to express the solutions for a general n.

Divide into cases. If $n$ is even, there is no solution, so from now on assume that $n$ is odd. 
There are two possibilities, (i)  $n$ is divisible by $3$ and (ii) $n$ not divisible by $3$. They are handled similarly but not identically. We do (i), and leave (ii) to you.
Let $n=3m$. Then our congruence is equivalent to $4x\equiv 3\pmod{m}$. If $m\equiv 1\pmod{4}$, then $x\equiv \frac{m+3}{4}\pmod{m}$ is the solution. If $m\equiv 3\pmod{4}$, then $x\equiv \frac{3m+3}{4}\pmod{m}$ is the solution.
