I am currently learning how to set up a local Microsoft SQL database with the goal of making it online in the future.
My question is about the max number of connections which are allowed at any one time.
#import required packages
import pyodbc
#define connection
conn = pyodbc.connect('connection string')
#create cursor
cursor = conn.cursor()
cursor2 = conn.cursor()
#check how many max connections available
how_many = conn.getinfo(pyodbc.SQL_MAX_CONCURRENT_ACTIVITIES)
print(how_many)
The answer I get with this is 1. Is this due to the fact that the database is local or will I get this same answer once I make the database online?
I don't want to keep working on this if I have chosen the wrong type of database even though google is telling me that MS SQL can handle ~32k connections at once.
My attempt to see if the max is indeed 2 is the following, everything works without error:
#use cursor 1 to query the database
this = cursor.execute('select * from tablename')
#get all data from the table in the database
rows = this.fetchall()
#loop over rows and print each row to the terminal
for row in rows:
print(row)
this2 = cursor2.execute('select * from tablename')
rows2 = this2.fetchall()
for row in rows2:
print(row)
#commit the connection, close the cursors, close the connection
conn.commit()
cursor.close()
cursor2.close()
conn.close()
Is this the correct way to test for this? Does this count as 2 concurrent connections?