The question is published on by Tutorial Guruji team.
I have several servers which use the Microsoft SQL Server JDBC driver. The files are all named
sqljdbc4.jar. I need to know what version of the driver each one contains. Time stamps and file sizes are not helpful, as I need to extract the driver version number. I need to be able to run this on the command line.
I have seen for DB2 you can run this command and get the version:
java -cp ./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -version
What is the equivalent, if any, for Microsoft SQL Server?
It seems that there is no dedicated CLI to print out the driver version but you can ask the MS 4.x driver for its version:
import java.sql.Driver; import com.microsoft.sqlserver.jdbc.SQLServerDriver; ... Driver driver = new SQLServerDriver(); driver.getMajorVersion(); // -> 4 driver.getMinorVersion(); // -> 0, 1, 2, ...
You could build a simple commandline wrapper to print out this information.