@ FFDCIgnore ( Exception . class ) private boolean checkDataSource ( DataSource nonTranDataSource ) { boolean fullyFormedDS = false ; try { nonTranDataSource = ( DataSource ) _dataSourceFactory . createResource ( null ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Non Tran dataSource is " + nonTranDataSource ) ; Connection conn = nonTranDataSource . getConnection ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Established connection " + conn ) ; DatabaseMetaData mdata = conn . getMetaData ( ) ; String dbName = mdata . getDatabaseProductName ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Database name " + dbName ) ; String dbVersion = mdata . getDatabaseProductVersion ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Database version " + dbVersion ) ; fullyFormedDS = true ; } catch ( Exception e ) { // We will catch an exception if the DataSource is not yet fully formed if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Caught exception: " + e ) ; } return fullyFormedDS ; }
See whether it is possible to get a connection and metatdata from a DataSOurce .