Example #1
0
    def run(self):

        while True:
            gd = Getdata(host,port,user,pwd)
            v_list = gd.getdata()
            # print v_list
            # print sql_test2x
            sI = Sqldb(dbhost,dbuser,dbpwd,dbport,dbname)
            sI.sqlLogin()
            sI.instData(sql_test2x,v_list)
Example #2
0


# 准备配置文件
conf = ConfigParser.ConfigParser()
conf.read("7liping-data.cfg")
# 设备的配置数据
host = conf.get('device1', 'host')
port = string.atoi(conf.get('device1', 'port'))
user = conf.get('device1', 'user')
pwd = conf.get('device1', 'password')
# 数据库的配置数据
dbhost = conf.get('db_mysql', 'host')
dbport = (conf.get('db_mysql', 'port'))
dbuser = conf.get('db_mysql', 'user')
dbpwd = conf.get('db_mysql', 'password')
dbname = conf.get('db_mysql', 'db')
dbtable = conf.get('db_mysql','table')


gD = Getdata(host,port,user,pwd)
v_list = gD.getdata()
vlist = v_list
# print v_list


sI = Sqldb(dbhost,dbuser,dbpwd,dbport,dbname,dbtable,vlist)
sI.sqlLogin()
sI.instData()