niedenzu

Hints and tricks for developers

Martins Amazon Wunschliste

DB2 show version in Servlet 16. July 2014

The JDBC-Driver is provided by the J2EE-Container. So your Web-Applications doesn’t really know which Version of a Driver is used. If you Google you will find following advice:

java -cp ./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -version

This is a way to display the used Version on Console. e.g. if you are a Server-Admin and you what to know which driver version is installed on the system.

String[] errorSoon = {"-version"}; DB2Jcc.main(errorSoon);

The problem is, that DB2Jcc.main does not return a String which you ca pass to the Servlet. So you want to know what DB2Jcc does.
The String you want to get generated by calling a static method qp.d();

import com.ibm.db2.jcc.am.qp; qp.d() ;

Of course, this is only working if you use DB2. So it is a good idea to Write a separate Servlet – in case that your app uses a another JDBC-Driver (Another Vendor or Version of DB2) that does not use this internal method.
No Comments on DB2 show version in Servlet
Categories: Uncategorized
Martin Rocks