pypyodbc: [Microsoft][ODBC SQL Server Driver][DBNE

2019-09-12 18:15发布

问题:

My python script reads through around half of the dataset (around 5000 rows out of 10000) and all of a sudden produces this error midway:

[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite (send())

I'm using pypyodbc to connect to the Azure SQL server. I haven't been able to find the solution anywhere online. I don't even know whats the cause that's leading to this error.

Please help.

回答1:

Hope you are doing well. Have you had a chance to look at pyodbc and pymssql?
They have a better community presence and are actively maintained. If the script fails with these drivers as well, there might be an issue with your script. I can try to help you troubleshoot if you share it.


Let me know if the issue gets fixed with the other drivers and if it does not I can help you out.

Thanks,
Meet Bhagdev
Program Manager, Microsoft



回答2:

I tried to reproduce the issue, but failed. And I observed that the package last updated in 2013. It's an old and no longer maintenance package for Python ODBC. So I don't recommend to continue to use it to access the latest Azure SQL Database.

I strongly recommended you to use the package pymssql. It's the Azure offical recommend odbc driver for Python, please refer to https://azure.microsoft.com/en-us/documentation/articles/sql-database-libraries/.

It can very good support any OS environment contains Windows, Linux, MacOS. You can refer to these docs https://azure.microsoft.com/en-us/documentation/articles/sql-database-develop-python-simple-windows/, https://azure.microsoft.com/en-us/documentation/articles/sql-database-develop-python-simple-ubuntu-linux/ and https://azure.microsoft.com/en-us/documentation/articles/sql-database-develop-python-simple-mac-osx/ to getting started.

If you want to dive into the package usgae, please refer to the offical document http://pymssql.org/en/latest/index.html.

Best Regards.