You forgot the normalization of the wavefunction. The integral you quote should be:
[tex]
\int_{ - \infty }^{ + \infty } {\psi (x)dx} = \frac{2B}{\kappa }
[/tex]
If you do the same trick, you'll just get 1=1 instead of what you have.