My question is how to get proper redshift Database version information from a Redshift JDBC Connection. Calling the JDBC DatabaseMetaData.getDatabaseMajorVersion() and DatabaseMetaData.getDatabaseMinorVersion simply returns 8 and 0 which I believe is just some hardcoded values. Is there a JDBC driver API call to get the some reasonable values?
My fallback solution is to use the VERSION function as documented in https://docs.aws.amazon.com/redshift/latest/dg/r_VERSION.html and extract the cluster version. This though requires me to run an SQL where I would like to use pure JDBC API calls. It also returns a long string (see below) and we would need to parse this string to get the cluster version (E.g 1.0.7804).
The VERSION function returns a string like the following
"PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.7804"