title: Python SQL Server login retry logic if login failed for user
body: <p>Python SQL Server login retry logic if login failed for user. I am using this logic in a script, but sometimes it's failing to login to the database.</p>
  <p>I want to retry to connect to the database if the connection fails.</p>
  <pre><code>try:
      cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
      cursor = cnxn.cursor()
  </code></pre>