Completing the square at the denominator gives
e^{2x} + 12e^x + 27 -= (e^x + 6)^2 - 9
To make use of the identity
sec^2u - 1 -= tan^2u,
substitute 3secu = e^x + 6.
Differentiate both sides w.r.t. x to get
3secu tanu frac{du}{dx} = e^x
= 3secu - 6
frac{du}{dx} = frac{3secu - 6}{3secu tanu}
= frac{1 - 2cosu}{tanu}
Now plugging it into the integration,
int frac{1}{sqrt{(e^x + 6)^2 - 9}} dx = int frac{1}{sqrt{(3secu)^2 - 9}} frac{tanu}{1 - 2cosu} du
= 1/3 int frac{du}{1 - 2cosu}
As cosu -= frac{1-tan^2(u/2)}{1+tan^2(u/2)}
Let v = tan(u/2)
Differentiating both sides w.r.t. u,
frac{dv}{du} = 1/2 sec^2(u/2)
= ( 1 + tan^2(u/2) )/2
= frac{1 + v^2}{2}
Plugging it into the integration,
1/3 int frac{du}{1 - 2cosu} = 1/3 int frac{ frac{2dv}{1 + v^2} }{1-2(frac{1 - v^2}{1 + v^2})}
= 1/3 int frac{2dv}{(1 + v^2) - 2(1 - v^2)}
= 1/3 int frac{2dv}{3v^2 - 1}
= 1/3 int (frac{1}{sqrt{3}v - 1} - frac{1}{sqrt{3}v + 1}) dv
= frac{1}{3sqrt{3}} int (frac{sqrt{3}}{sqrt{3}v - 1} - frac{sqrt{3}}{sqrt{3}v + 1}) dv
= frac{1}{3sqrt{3}} ln(frac{sqrt{3}v - 1}{sqrt{3}v + 1}) + C_1, where C_1 is the constant of integration.
= frac{1}{3sqrt{3}} ln(frac{tan(u/2) - 1/sqrt{3}}{tan(u/2) + 1/sqrt{3}}) + C_1
As tan^2(u/2) -= frac{secu - 1}{ secu + 1}
frac{1}{3sqrt{3}} ln(frac{tan(u/2) - 1/sqrt{3}}{tan(u/2) + 1/sqrt{3}}) + C_1 = frac{1}{3sqrt{3}} ln(frac{sqrt{frac{secu - 1}{secu + 1}} - 1/sqrt{3}}{sqrt{frac{secu - 1}{secu + 1}} + 1/sqrt{3}}) + C_1
= frac{1}{3sqrt{3}} ln(frac{sqrt{frac{frac{e^x + 6}{3} - 1}{frac{e^x + 6}{3} + 1}} - 1/sqrt{3}}{sqrt{frac{frac{e^x + 6}{3} - 1}{frac{e^x + 6}{3} + 1}} + 1/sqrt{3}}) + C_1
= frac{1}{3sqrt{3}} ln(frac{sqrt{frac{e^x + 3}{e^x + 9}} - 1/sqrt{3}}{sqrt{frac{e^x + 3}{e^x + 9}} + 1/sqrt{3}}) + C_1
= frac{1}{3sqrt{3}} ln(frac{sqrt{3}sqrt{e^x + 3} - sqrt{e^x + 9}}{sqrt{3}sqrt{e^x + 3} + sqrt{e^x + 9}}) + C_1
= frac{1}{3sqrt{3}} ln(frac{(sqrt{3}sqrt{e^x + 3} - sqrt{e^x + 9})^2}{3(e^x + 3) - (e^x + 9)}) + C_1
= frac{1}{3sqrt{3}} ln(frac{(sqrt{3}sqrt{e^x + 3} - sqrt{e^x + 9})^2}{2e^x }) + C_1
= frac{1}{3sqrt{3}} ln((sqrt{3}sqrt{e^x + 3} - sqrt{e^x + 9})^2) - frac{1}{3sqrt{3}} ln(2e^x) + C_1
= frac{2}{3sqrt{3}} ln(sqrt{3}sqrt{e^x + 3} - sqrt{e^x + 9}) - frac{x}{3sqrt{3}} + C_2, where C_2 = C_1 - frac{ln2}{3sqrt{3}}
= frac{2ln(sqrt{3e^x + 9} - sqrt{e^x + 9})-x}{3sqrt{3}} + C_2