All the indefinite integrals is tables can either be done by some integration method, and not just differentiating a lot of functions to see if they give what they want. Its not always a standard method though, some tricks are sometimes required. Other times, there actually is no elementary anti-derivative and they instead define that integral to be another function.
For your specific integral, There are a few ways of doing it.
A common way is (writing 1/cos x as sec x) multiplying the integrand through by (sec x + tan x). However, that makes it seem like you've already done this before and hence you know you can rely of this otherwise remarkable step.
So the way I prefer to do it as many people might see more easily, though it takes some more work. Multiply the integrand through by cos x, use the pythagorean identity on the denominator, a simple substitution and partial fractions, were home free =]