private String getDatabaseProductName ( WSDataSource dataSource ) throws Exception { String dbProductName = dataSource . getDatabaseProductName ( ) ; if ( dbProductName == null ) { // Query the metadata under a new transaction and commit right away LocalTransactionCurrent localTranCurrent = this . localTranCurrent ; LocalTransactionCoordinator suspendedLTC = localTranCurrent . suspend ( ) ; EmbeddableWebSphereTransactionManager tranMgr = this . tranMgr ; Transaction suspendedTran = suspendedLTC == null ? tranMgr . suspend ( ) : null ; boolean tranStarted = false ; try { tranMgr . begin ( ) ; tranStarted = true ; Connection con = dataSource . getConnection ( ) ; try { dbProductName = con . getMetaData ( ) . getDatabaseProductName ( ) ; } finally { con . close ( ) ; } } finally { try { if ( tranStarted ) tranMgr . commit ( ) ; } finally { // resume if ( suspendedTran != null ) tranMgr . resume ( suspendedTran ) ; else if ( suspendedLTC != null ) localTranCurrent . resume ( suspendedLTC ) ; } } } return dbProductName ; }
Obtain the database product name from the database to which the data source connects .