Can I use multiple cursors on one connection with pyodbc and MS SQL Server?

泪湿孤枕 提交于 2019-11-29 05:52:00

This appears to be supported via multithreading: http://technet.microsoft.com/en-US/library/ms131700(v=sql.90).aspx

According to this guy

Cursor objects are used to execute SQL statements. ODBC and pyodbc allow multiple cursors per connection, but not all databases support this.

and you can determine concurrent cursors can be supported with:

import pyodbc
connection = pyodbc.connect(...)
how_many = connection.getinfo(pyodbc.SQL_MAX_CONCURRENT_ACTIVITIES)
print(how_many)

I my own practice I have never met necessity to use more than one database cursor. Such problems are used to be solved by sophisticated SQL queries (joins, groups). Or (if you can to ignore perfomance issues) by using several simple queries.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!