Factorize parsing of hostname and port

and remove wrong constraint on database name.

issue2911
review13521002
Don't set adjustment value outside the range

If adjustement value is set to a value outside the range, GTK can no more
compute the visible range.

issue4075
review8561002