当前位置:网站首页>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()
边栏推荐
- 华为22级专家十年心血终成云原生服务网格进阶实战文档,是真的6
- [数学建模]Matlab非线性规划之fmincon()函数
- At the end of June, how many people in Kangkang are ready to change jobs
- note
- [chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
- 2022年PMP项目管理考试敏捷知识点(4)
- Matlab learning notes (6) upsample function and downsample function of MATLAB
- Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
- Ahai's advice
- ctfshow XSS
猜你喜欢

从SQL注入绕过最新安全狗WAF中学习fuzz

Learn binary tree like this

【OpenCV】—线性滤波:方框滤波、均值滤波、高斯滤波

Chapter II Classic synchronous exercises

【状态机设计】Moore、Mealy状态机、三段式、二段式、一段式状态机书写规范

Interviewer: what is the internal implementation of strings in redis?

YuMinHong set up two funds funded by his hometown

移动端异构运算技术 - GPU OpenCL 编程(基础篇)

Counting sorting and stability of sorting

Web API learning notes 1
随机推荐
Chapter V virtual memory exercise
When dialogfragment's onstop is completely invisible, call disass to exit the interface and report an error. Solution
自媒体行业内卷严重:企业自媒体应该何去何从
是使用local_setup.bash 还是 setup.bash
Count the number of arrays with pointers
LINQ linked table query
机器学习6-决策树
Chapter II Classic synchronous exercises
Cs5463 code module analysis (including download link)
[API packet capturing in selenium automation] installation and configuration of browsermobproxy
Insomnia last night
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding
论文解读(DCN)《Towards K-means-friendly Spaces: Simultaneous Deep Learning and Clustering》
Do you know all the wonderful functions of the vlookup function?
LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路
With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
MSCI 2022 market classification assessment
C language - word analysis
非科班!自学之路!
【SSM】报错 Access denied for user ‘WYF‘@‘localhost‘ (using password: YES) 数据的用户名变成了电脑的用户名