Beispiel #1
0
 def _getMSSQLNatDS(self, sql,bv=[], po='SEL'):
     self.log.debug('qry = %s' % sql)
     cs = getDSConnStr('MSSQLNAT', self.ib.user, self.ib.pwd, self.ib.dbserver, self.ib.db)
     dbh = MSSQLNat(cs, self.log)
     rc  = dbh.connToDB ()
     if rc != 0 :
         self.log.error('Could not connect to the DB rc = %s ' % rc)
         return None
      
     if po == 'SEL': r = dbh.runQry(sql)
     else          : r = dbh.exeQry(sql,bv)
     dbh.closeDBConn()
     return r
Beispiel #2
0
 def connToDB(self):
     r = 1
     sql = 'SELECT GETDATE() AS [CurrentDate]'
     self.logger.debug('qry = %s' % sql)
     cs = getDSConnStr('MSSQLNAT',self.ib.db_user,self.ib.db_pwd,self.ib.db_server,self.ib.db_name)
     self.logger.debug('ConnStr %s' % cs)
     dbh = MSSQLNat(cs,self.logger)
     if dbh.connToDB() != 0 : return r
     
     rs = dbh.runQry(sql)
     if rs is not None and len(rs) > 0 :  
         r = 0
         self.logger.debug("rs = %s" % rs[0][0])
     
     dbh.closeDBConn()
     return r