当前位置:网站首页>pymysql. Error get error code and specific error information
pymysql. Error get error code and specific error information
2022-06-28 23:25:00 【supramolecular】
#-*-coding:utf-8-*-
import pymysql
import time
import traceback
# Open database connection
db = pymysql.connect("127.0.0.1", "root", "123456", "dbname")
# Use cursor() Method get operation cursor
cursor = db.cursor(cursor=pymysql.cursors.DictCursor)
try:
# perform sql sentence
cursor.execute(sql)
# Commit to database execution
db.commit()
# except:
except pymysql.Error as e:
print(e.args[0], e.args[1])
# print(e[0])
# traceback.print_exc()
# Roll back if an error occurs
# Close database connection
db.close()
边栏推荐
- 表单校验问题——el-select(初始化页面自动触发校验解决办法)
- Encounter with avita 11: long lost freshness under strong product power
- I can't sleep
- MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数
- Didn't find an internship. He summed it up
- scrapy保存数据到excel:利用openpyxl创建多张表,设置Excel行数限制
- Chapter IV memory management exercise
- Be on the list again! Know that Chuangyu was selected as one of the top 50 competitive enterprises in China's network security industry in 2022
- That's how he did it!
- Chapter II Classic synchronous exercises
猜你喜欢

PHP 使用endroid/qrcode 二维码生成, GD库生成分享海报

Behaviortree in ros2
![[stm32 Hal library] serial port communication](/img/2c/23a2ecf75141b8f38ab99ac6b2eaef.png)
[stm32 Hal library] serial port communication

Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal

笔记

ERROR 1067 (42000): Invalid default value for ‘end_time‘ Mysql

Tanghongbin, Yaya live CTO: to truly localize, the product should not have the attribute of "origin"

Encounter with avita 11: long lost freshness under strong product power

One card can sell tens of millions, and the business expansion is faster than that of players: you don't understand the Jianghu of star cards

At the end of June, how many people in Kangkang are ready to change jobs
随机推荐
[mathematical modeling] fmincon() function of MATLAB nonlinear programming
Serious internal entanglement in the we media industry: where should the enterprise we media go
Chapter II Classic synchronous exercises
At the end of June, how many people in Kangkang are ready to change jobs
Undefined symbol main (referred from entry9a.o).
移动端异构运算技术 - GPU OpenCL 编程(基础篇)
【Flutter 问题系列第 71 篇】Flutter 中 Uint8List 和 Image 之间的相互转换
计数排序和排序的稳定性
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding
window10 phpstudy 安装redis扩展
Class extension and optional type extension of dart
TDD case practice
C# 面试题目_20220627记录一下
华为22级专家十年心血终成云原生服务网格进阶实战文档,是真的6
Langage C - analyse des mots
LINQ linked table query
Non scientific class! The road of self-study!
Junior, it's not easy!
[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word
[state machine design] Moore, Mealy state machine, three-stage, two-stage and one-stage state machine writing specification