My textbook defined integrability as $f$ is said to be Lebesgue integrable if $\int{}f$ is finite.
I heard that $\frac1x$ is not Lebesgue integrable, but $\frac{1}{x^2}$ is Lebesgue integrable.
I do not agree with the fact above. $\int\frac{1}{x^2}$ is not finite, I think. I know $\sum \frac{1}{n} = \infty$, but $\sum \frac{1}{n^2} = \frac{\pi^2}{6}$. However, $\int_0^1\frac{1}{x^2}dx = \left[-\frac{1}{x}\right]_0^1 = -1 + \infty = +\infty$, which is not finite.
The "naked" expression $\int f$ makes no sense. We can, however, talk about the definite integrals $$\int_1^\infty{1\over x}\>dx,\qquad \int_1^\infty{1\over x^2}\>dx\ .\tag{1}$$
In the Riemann integral environment these integrals are not bona-fide integrals, but should be considered as improper integrals. This means that one resorts to $$\int_1^\infty{1\over x}\>dx:=\lim_{b\to\infty} \int_1^b{1\over x}\>dx=\lim_{b\to\infty}\log b=\infty\ ,$$ hence the integral is divergent, and similarly $$\int_1^\infty{1\over x^2}\>dx:=\lim_{b\to\infty} \int_1^b{1\over x^2}\>dx=\lim_{b\to\infty}-{1\over x}\biggr|_1^b=1\ .$$ In the Lebesgue framework both integrals $(1)$ are thought of right from the start as ranging over the interval $[1,\infty[\>$. The first then has the value $\infty$, hence $x\mapsto{1\over x}$ is not integrable over this interval, and the second of course proudly (i.e., not obtained by some exception-handling) has the value $1$.