Underlying database and driver used by Spring JdbcTemplate

I had an issue when migrating my Spring applications to OCI (Oracle Call Interface) from Oracle JDBC. Needless to say, I found 3 different ojdbc14.jar with the same version but different file sizes. classes12.jar was in the configuration libraries too.

I used the following code to find the Database version and the Driver Name and it helped me resolve my issues.

String databaseName = (String) JdbcUtils.extractDatabaseMetaData(this.jdbcTemplate.getDataSource(),
String databaseVersion = (String) JdbcUtils.extractDatabaseMetaData(this.jdbcTemplate.getDataSource(),
String driverName = (String) JdbcUtils.extractDatabaseMetaData(this.jdbcTemplate.getDataSource(),
String driverVersion = (String) JdbcUtils.extractDatabaseMetaData(this.jdbcTemplate.getDataSource(),
log.info(“Database Name: ” + databaseName);
log.info(“Database Version: ” + databaseVersion);
log.info(“Driver Name: ” + driverName);
log.info(“Driver Version: ” + driverVersion);

The output was

2009-04-07 13:33:36,406 INFO OrderDaoJdbc:{OrderDaoJdbc.java:141} – Database Name: Oracle
2009-04-07 13:33:36,406 INFO OrderDaoJdbc:{OrderDaoJdbc.java:142} – Database Version: Oracle9i Enterprise Edition Release – 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release – Production
2009-04-07 13:33:36,406 INFO OrderDaoJdbc:{OrderDaoJdbc.java:143} – Driver Name: Oracle JDBC driver
2009-04-07 13:33:36,406 INFO OrderDaoJdbc:{OrderDaoJdbc.java:144} – Driver Version:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s