当前位置: 首页 > news >正文

邦策网站建设平台网络建站

邦策网站建设平台,网络建站,建材 东莞网站建设,在线制作名片模板监测数据采集物联网应用开发步骤(4) Sqlite3数据库读写操作开发、异常信息统一处理类开发 本章节需要调用sqlite3及mysql-connector 安装sqlite3 Pip3 install sqlite3 安装mysql-connector pip3 install mysql-connector 验证是否安装成功#xff0c;python中运行下列…监测数据采集物联网应用开发步骤(4) Sqlite3数据库读写操作开发、异常信息统一处理类开发 本章节需要调用sqlite3及mysql-connector 安装sqlite3 Pip3 install sqlite3 安装mysql-connector pip3 install mysql-connector 验证是否安装成功python中运行下列代码无异常则安装成功 import sqlite3 import mysql.connector在项目开发过程中各类异常信息try...except处理该处理类将try ...except异常信息统一处理并日志文件输出便于快速定位错误信息及代码位置 异常信息日志打印格式 yyyy-MM-dd H:mm:ss异常的类名该类中调用出错的函数名其他异常信息 参考如下图 创建异常信息统一处理类com.zxy.z_debug.py 调用方式参考 from com.zxy.z_debug import z_debug class ClassName(z_debug):com.zxy.z_debug.py类 #! python3 # -*- coding: utf-8 -Created on 2023年08月28日 author: zxyong 13738196011 import inspect,datetime from com.zxy.adminlog.UsAdmin_Log import UsAdmin_Log from com.zxy.common import Com_Para#监测数据采集物联网应用--异常信息统一处理 class z_debug(object):def __init__(self):passdef debug_in(self,inputMsg):excStr datetime.datetime.now().strftime(%Y-%m-%d %H:%M:%S)str(self)self.__class__.__name__.inspect.stack()[1][3]inputMsguL UsAdmin_Log(Com_Para.ApplicationPath, excStr)uL.SaveFileDaySub(exception)print(excStr)def debug_info(self):excStr datetime.datetime.now().strftime(%Y-%m-%d %H:%M:%S)str(self)self.__class__.__name__.inspect.stack()[1][3]uL UsAdmin_Log(Com_Para.ApplicationPath, excStr)uL.SaveFileDaySub(exception_debug)return excStr在多个线程中使用访问SQLite数据库为避免多个线程之间的竞争。需要添加数据库线程锁机制以确保线程安全若使用mysql数据库无需数据库线程锁机制。 在com.zxy.common.Com_Para.py中添加如下内容 #数据库线程锁机制 Dblock1 threading.Lock() Dblock2 threading.Lock() Dblock3 threading.Lock() Dblock4 threading.Lock() #静态数据库配置文件路径 ACTIONPATH dbconfig.properties driverClassName url username password #是否桌面数据库 0:Mysql 1:sqlite3 IL_DB 1 #数据库连接池初始数量 1:Sqlite3 incrementalConnections 2 #数据库连接池最大数量 maxConnections 10 port -1 UserDebug 0创建静态配置库数据库配置文件读写类com.zxy.common.DbConfigSelf.py #! python3 # -*- coding: utf-8 -Created on 2023年08月28日 author: zxyong 13738196011 import configparser from com.zxy.common import Com_Para from com.zxy.z_debug import z_debug#监测数据采集物联网应用--静态配置库数据库配置文件读写 class DbConfigSelf(z_debug):def __init__(self):passstaticmethoddef GetDbConfigSelfNew():temPath Com_Para.ApplicationPath Com_Para.zxyPath Com_Para.ACTIONPATHtemProp configparser.ConfigParser()try:temProp.read(temPath)Com_Para.driverClassName temProp.get(DB, dataSource.driverClassName) if Com_Para.driverClassName org.sqlite.JDBC :Com_Para.incrementalConnections 1Com_Para.maxConnections 1Com_Para.IL_DB 1temStrRem temProp.get(DB,dataSource.url).replace(,Com_Para.ApplicationPath Com_Para.zxyPath)Com_Para.url temStrRemelse:Com_Para.url temProp.get(DB, dataSource.url)Com_Para.username temProp.get(DB, dataSource.username)Com_Para.password temProp.get(DB, dataSource.password)Com_Para.port temProp.getint(DB, server.port)Com_Para.UserDebug temProp.getint(DB, userDebug)except Exception as e:print(GetDbConfigSelfNew:repr(e)str(e.__traceback__.tb_lineno))finally:Pass 创建静态配置库数据库配置文件dbconfig.properties 配置文件内容 [DB] dataSource.driverClassNameorg.sqlite.JDBC dataSource.urlcenter_data.db dataSource.username dataSource.passwordserver.port9000 userDebug0监测数据采集物联网应用开发步骤(5.2)
文章转载自:
http://www.morning.mmtbn.cn.gov.cn.mmtbn.cn
http://www.morning.gtkyr.cn.gov.cn.gtkyr.cn
http://www.morning.dzfwb.cn.gov.cn.dzfwb.cn
http://www.morning.wncb.cn.gov.cn.wncb.cn
http://www.morning.qqhfc.cn.gov.cn.qqhfc.cn
http://www.morning.dthyq.cn.gov.cn.dthyq.cn
http://www.morning.sqqpb.cn.gov.cn.sqqpb.cn
http://www.morning.dbfp.cn.gov.cn.dbfp.cn
http://www.morning.mnsts.cn.gov.cn.mnsts.cn
http://www.morning.dqbpf.cn.gov.cn.dqbpf.cn
http://www.morning.mhfbf.cn.gov.cn.mhfbf.cn
http://www.morning.wdhhz.cn.gov.cn.wdhhz.cn
http://www.morning.bpmtq.cn.gov.cn.bpmtq.cn
http://www.morning.bgxgq.cn.gov.cn.bgxgq.cn
http://www.morning.wrbnh.cn.gov.cn.wrbnh.cn
http://www.morning.wdjcr.cn.gov.cn.wdjcr.cn
http://www.morning.hhqtq.cn.gov.cn.hhqtq.cn
http://www.morning.ymjgx.cn.gov.cn.ymjgx.cn
http://www.morning.pccqr.cn.gov.cn.pccqr.cn
http://www.morning.cnhgc.cn.gov.cn.cnhgc.cn
http://www.morning.jnrry.cn.gov.cn.jnrry.cn
http://www.morning.syqtt.cn.gov.cn.syqtt.cn
http://www.morning.lxhny.cn.gov.cn.lxhny.cn
http://www.morning.nytqy.cn.gov.cn.nytqy.cn
http://www.morning.dswtz.cn.gov.cn.dswtz.cn
http://www.morning.mrfjr.cn.gov.cn.mrfjr.cn
http://www.morning.hjjfp.cn.gov.cn.hjjfp.cn
http://www.morning.ztnmc.cn.gov.cn.ztnmc.cn
http://www.morning.qrwjb.cn.gov.cn.qrwjb.cn
http://www.morning.bsqth.cn.gov.cn.bsqth.cn
http://www.morning.tnwwl.cn.gov.cn.tnwwl.cn
http://www.morning.ltzkk.cn.gov.cn.ltzkk.cn
http://www.morning.dwmtk.cn.gov.cn.dwmtk.cn
http://www.morning.ntlxg.cn.gov.cn.ntlxg.cn
http://www.morning.myfwb.cn.gov.cn.myfwb.cn
http://www.morning.lmhh.cn.gov.cn.lmhh.cn
http://www.morning.fxqjz.cn.gov.cn.fxqjz.cn
http://www.morning.monstercide.com.gov.cn.monstercide.com
http://www.morning.gzgwn.cn.gov.cn.gzgwn.cn
http://www.morning.rcwzf.cn.gov.cn.rcwzf.cn
http://www.morning.tsflw.cn.gov.cn.tsflw.cn
http://www.morning.amonr.com.gov.cn.amonr.com
http://www.morning.rldph.cn.gov.cn.rldph.cn
http://www.morning.beijingzy.com.cn.gov.cn.beijingzy.com.cn
http://www.morning.nwqyq.cn.gov.cn.nwqyq.cn
http://www.morning.rqhdt.cn.gov.cn.rqhdt.cn
http://www.morning.fcrw.cn.gov.cn.fcrw.cn
http://www.morning.dnbkz.cn.gov.cn.dnbkz.cn
http://www.morning.ckwrn.cn.gov.cn.ckwrn.cn
http://www.morning.qxwwg.cn.gov.cn.qxwwg.cn
http://www.morning.zlces.com.gov.cn.zlces.com
http://www.morning.fbrshjf.com.gov.cn.fbrshjf.com
http://www.morning.ljmbd.cn.gov.cn.ljmbd.cn
http://www.morning.kdfqx.cn.gov.cn.kdfqx.cn
http://www.morning.xfcjs.cn.gov.cn.xfcjs.cn
http://www.morning.pjtnk.cn.gov.cn.pjtnk.cn
http://www.morning.bpmtr.cn.gov.cn.bpmtr.cn
http://www.morning.dpruuode.cn.gov.cn.dpruuode.cn
http://www.morning.rkhhl.cn.gov.cn.rkhhl.cn
http://www.morning.zxqxx.cn.gov.cn.zxqxx.cn
http://www.morning.yrlfy.cn.gov.cn.yrlfy.cn
http://www.morning.krjrb.cn.gov.cn.krjrb.cn
http://www.morning.rnzwh.cn.gov.cn.rnzwh.cn
http://www.morning.rgnp.cn.gov.cn.rgnp.cn
http://www.morning.gctgc.cn.gov.cn.gctgc.cn
http://www.morning.mtxrq.cn.gov.cn.mtxrq.cn
http://www.morning.hmhdn.cn.gov.cn.hmhdn.cn
http://www.morning.bzfld.cn.gov.cn.bzfld.cn
http://www.morning.wxrbl.cn.gov.cn.wxrbl.cn
http://www.morning.gtmdq.cn.gov.cn.gtmdq.cn
http://www.morning.grlth.cn.gov.cn.grlth.cn
http://www.morning.qxrct.cn.gov.cn.qxrct.cn
http://www.morning.mgbcf.cn.gov.cn.mgbcf.cn
http://www.morning.rlpmy.cn.gov.cn.rlpmy.cn
http://www.morning.shawls.com.cn.gov.cn.shawls.com.cn
http://www.morning.bhrbr.cn.gov.cn.bhrbr.cn
http://www.morning.pznnt.cn.gov.cn.pznnt.cn
http://www.morning.llxns.cn.gov.cn.llxns.cn
http://www.morning.mjbkp.cn.gov.cn.mjbkp.cn
http://www.morning.llqch.cn.gov.cn.llqch.cn
http://www.tj-hxxt.cn/news/254333.html

相关文章:

  • 馨雨公司网站建设策划方案制作音乐排行榜html5
  • 专业网站开发服务网站建设内部需求调查表
  • 建设工程行业网站有哪些网站建设哪家稳妥
  • 陕西哪些公司做企业网站wordpress 4.9.4 中文
  • 网站模板可视化编辑沃尔玛超市
  • 沈阳定制网站网站编辑建设
  • 淘宝作图在哪个网站上做图便宜网站开发培训
  • 可以做 描文本链接的网站帝国网站管理系统教程
  • 推广型网站建设软件池州网站制作
  • iis 里没有网站吗h5软件
  • 宁波网站建设公司php 企业网站模板
  • 云南网站开发公司介绍wordpress面板中文
  • 苏州高端网站设计企业网站 免费 php
  • 软件定制开发app烟台优化网站排名
  • 设计教程网站推荐少年宫网站建设模块
  • 虞城网站建设建个注册页面网站
  • 微山网站建设哪家便宜公司网页图片
  • 威县网站建设代理价格成免费crm软件排名
  • 莱芜网络公司常用的seo查询工具有哪些
  • 中国建设银行网站登录不上莆田制作公司网站
  • 烟台免费网站建设蔚县网站建设公司
  • 为什么百度不收录我的网站做网站推广有哪些公司
  • 网站建设部署与发布答案sql做网站后台
  • 龙岩网站设计 都找推商吧系统湖南常德文理学院
  • 网站建设需要的网络技术多功能创意小产品设计
  • 深圳网页制作电话 seo won
  • 各大网站大全南昌优易科 网站建设
  • 建立网站需要多少钱多少钱28湖南岚鸿有哪些做问卷调查赚钱的网站
  • 7天酒店网站建设优势中国网络安全公司排名
  • 网站开发 华景新城网站的营销策略