def dbValidator():
 fileused = getFileUsed()
 host = Configuration.get('nupic.cluster.database.host')
 port = int(Configuration.get('nupic.cluster.database.port'))
 user = Configuration.get('nupic.cluster.database.user')
 passwd = ('*' * len(Configuration.get('nupic.cluster.database.passwd')))
 print 'This script will validate that your MySQL is setup correctly for '
 print 'NuPIC. MySQL is required for NuPIC swarming. The settings are'
 print 'defined in a configuration file found in  '
 print '$NUPIC/src/nupic/support/nupic-default.xml Out of the box those '
 print "settings contain MySQL's default access credentials."
 print
 print 'The nupic-default.xml can be duplicated to define user specific '
 print 'changes calling the copied file '
 print '$NUPIC/src/nupic/support/nupic-site.xml Refer to the '
 print 'nupic-default.xml for additional instructions.'
 print
 print 'Defaults: localhost, 3306, root, no password'
 print
 print 'Retrieved the following NuPIC configuration using: ', fileused
 print '    host   :    ', host
 print '    port   :    ', port
 print '    user   :    ', user
 print '    passwd :    ', passwd
 if testDbConnection(host, port, user, passwd):
  print 'Connection successful!!'
 else:
  print "Couldn't connect to the database or you don't have the permissions required to create databases and tables. Please ensure you have MySQL\n installed, running, accessible using the NuPIC configuration settings, and the user specified has permission to create both databases and tables."

def dbValidator ( ) : fileused = getFileUsed ( ) host = Configuration . get ( 'nupic.cluster.database.host' ) port = int ( Configuration . get ( 'nupic.cluster.database.port' ) ) user = Configuration . get ( 'nupic.cluster.database.user' ) passwd = ( '*' * len ( Configuration . get ( 'nupic.cluster.database.passwd' ) ) ) print 'This script will validate that your MySQL is setup correctly for ' print 'NuPIC. MySQL is required for NuPIC swarming. The settings are' print 'defined in a configuration file found in  ' print '$NUPIC/src/nupic/support/nupic-default.xml Out of the box those ' print "settings contain MySQL's default access credentials." print print 'The nupic-default.xml can be duplicated to define user specific ' print 'changes calling the copied file ' print '$NUPIC/src/nupic/support/nupic-site.xml Refer to the ' print 'nupic-default.xml for additional instructions.' print print 'Defaults: localhost, 3306, root, no password' print print 'Retrieved the following NuPIC configuration using: ' , fileused print '    host   :    ' , host print '    port   :    ' , port print '    user   :    ' , user print '    passwd :    ' , passwd if testDbConnection ( host , port , user , passwd ) : print 'Connection successful!!' else : print "Couldn't connect to the database or you don't have the permissions required to create databases and tables. Please ensure you have MySQL\n installed, running, accessible using the NuPIC configuration settings, and the user specified has permission to create both databases and tables."
let the user know what nupic config file is being used and whether or not they have mysql set up correctly for swarming .