0
votes

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"

1

1 Answers

0
votes

You can use the AWS CLI / API to call redshift describe-cluster-db-revisions

e.g. using cli

aws redshift describe-cluster-db-revisions

This returns a json object describing each cluster including an object "CurrentDatabaseRevision" which contains the current db revision. Currently for me this shows as "7562".

See

https://docs.aws.amazon.com/cli/latest/reference/redshift/describe-cluster-db-revisions.html

and

https://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterDbRevisions.html