Exemplo n.º 1
0
 def _create_db_conn(self):
     db_section = 'DATABASE'
     db_conn = None
     try:
         db_conn = ZDbConn.create_db_connection(self._cfg_parser.get(db_section, 'type'),
                                                self._cfg_parser.get(db_section, 'host'),
                                                self._cfg_parser.get(db_section, 'user'),
                                                self._cfg_parser.get(db_section, 'password'),
                                                self._cfg_parser.get(db_section, 'db'))
     except Exception as e:
         exc_type, exc_value, exc_traceback = sys.exc_info()
         logging.error('Scanner._create_db_conn encounting error %s' 
                       %(''.join(format_exception(exc_type, exc_value, exc_traceback))))
     return db_conn 
Exemplo n.º 2
0
 def _create_db_connection(self, section_name):
     section = self.cfg[section_name]
     return ZDbConn.create_db_connection(section['Type'], section['Host'], 
                                         section['User'], section['Password'], 
                                         section['DB'])