# # Test DB connection Proc. # #################################################################### # Patrick Finnegan 14032007. V1. #################################################################### #################################################################### # Test the connection to the datasource. #################################################################### proc testDBConnection { dataSourceName } { global AdminConfig global AdminControl set procName [ lindex [ info level 0 ] 0 ] putsLog "## proc - $procName" foreach i [ info args $procName ] { upvar 0 $i ilocal set propertiesArray($i) $ilocal } putsLog "procedure arguments are................." foreach { a b } [ array get propertiesArray ] { putsLog [ format "%-35s %s" "$a" "$b" ] } set dataSourceId [ $AdminConfig getid /DataSource:$dataSourceName/] if { $dataSourceId == {} } { putsLog "ERROR: DataSource $dataSourceName does not exist" return -code error } if { [ catch { $AdminControl testConnection $dataSourceId } r ] == 0 } { putsLog "test connection successfull" putsLog $r } else { putsLog "ERROR: test connection failed" putsLog $r return -code error } }