Improve the way we get the database version

server_version_num is guaranteed to return a parseable value, different from
server_version.

Change-Id: I94912d1c8d137ed30db17dea04bc024fe683cb97