Background
Error thrown when inserting data into SQL Server database using Python:
Cannot commit transaction: (3902,b'The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
DB-Lib error message 20018, severity 16:\nGeneral SQL Server error:Check messages from the SQL Server\n')
analysis
Well, there’s no reason. But a solution was found by accident.
solve
The error caused by the field type in sqlserver. The error I encountered is: one of the fields is set to date type. When inserting data, I report an error. Change the date type to varchar type, the problem is solved, and the data is inserted normally.
Summary
The varchar type may affect the data usage. Solve the problem first, and then solve the problem later. I think that inserting varchar data into the database is the most stable (personal experience).
Personal ability is limited, if there is a mistake welcome to correct!
Read More:
- Spring failed to commit the transaction
- Solve “error: failed to commit transaction” in arch Linux
- After switching the tidb database, an error could not commit JDBC transaction appears from time to time
- Error: current transaction is aborted, commands ignored until end of transaction blockp
- Solving attributeerror: module ‘urllib’ has no attribute ‘request’
- Common mistakes in WCF distributed development (15): Communication with the underlying transaction manager has failed.
- How to cancel the commit, how to cancel the commit after git commit, and how to change the submitted content
- [Java] spring transaction control configuration error, application- persstence.xml Transaction manager report red in file
- Mybatis openSession.commit () manually submit data and openSession.commit (true) automatically submit data
- There has been an error processing your request magento
- Something‘s wrong–perhaps a missing \item. \begin{thebibliography}{1}
- Solution to Error 400. The request has an invalid header name
- Magento prompts “there has been an error processing your request”
- 209151; org.json.JSONException A JSONObject text must begin with'{‘at character 1 of {
- iphonexx has denied the launch request
- LaTeX Error: Missing \begin{document}
- Jsoneexception: a jsonobject text must begin with ‘{at character 0
- egg.js The frame post request reported an error of invalid CSRF token security verification, which has been solved
- Flask Request an extension before_request after_request errorhandler
- XMIND save error “a jsonobject text must begin with ‘{at 1 [character 2 Line 1]” solution