Fix a couple of trivial Statement leaks.

Found by Coverity.
Plug some Statement leaks in metadata queries.

These are fairly harmless, nobody calls these metadata methods frequently
enough for the leaks to matter, and a regular Statement doesn't hold onto
any server resources anyway. But let's appease Coverity.
Avoid integer overflow.

The function returns long, but does the calculation first in int. If someone
sets the timeout to 600 hours in the URL, it will overflow, even though the
return value of the function is long and hence could return a larger value.

To silence a Coverity complaint.
Use StringBuffer to construct a string.

This piece of code isn't performance-critical at all, but silences a
Coverity complaint.