Skip to content

Instantly share code, notes, and snippets.

@hhue13
Last active July 28, 2021 10:41
Show Gist options
  • Save hhue13/d43bb1ff6fb6b831cb85f3fb060606bb to your computer and use it in GitHub Desktop.
Save hhue13/d43bb1ff6fb6b831cb85f3fb060606bb to your computer and use it in GitHub Desktop.
Small Java class to determine the version of he MS-SQL driver version.
// To run it execute: java -cp <path>/getMSSQLDriverVersion.jar:<path>/mssql.jar at.twoinnovate.hhue.epo.GetMSSQLDriverVersion
package at.twoinnovate.hhue.epo;
import com.microsoft.sqlserver.jdbc.*;
public class GetMSSQLDriverVersion {
public static void main(String[] args) throws SQLServerException {
SQLServerDatabaseMetaData metaData = new SQLServerDatabaseMetaData(null);
String driverVersion = metaData.getDriverVersion();
System.out.println(String.format("MS SQL Driver version is:'%s'", driverVersion));
}
}
@hhue13
Copy link
Author

hhue13 commented Jul 28, 2021

Results in an output like:
[hhuebler@hhuelinux shm]$ java -cp ./getMSSQLDriverVersion.jar:/2tmp/epo/mssql.jar at.twoinnovate.hhue.epo.GetMSSQLDriverVersion
MS SQL Driver version is:'6.2.2.0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment