title: Connect to SQL Server Express Database with Python (Windows Authentication)
body: <p>I've got a Java Program connected to my SQLServer Express Database. The code I used to connect is:</p>
  
  <pre><code>Connection con = null;
  try {   
      String url = "jdbc:sqlserver://GANESHA\\SQLEXPRESS:1434;databaseName=4YP;integratedSecurity=true";
      Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      con = DriverManager.getConnection(url);
  }
  </code></pre>
  
  <p>I have since decided to use Python instead but can't seem to get it to connect to my database. The code I've been using is:</p>
  
  <pre><code>import pyodbc
  
  con_str = (
      r'Driver = {SQL SERVER};'
      r'Server = .\GANESHA;'
      r'Database = 4YP;'
      r'TrustedConnection = yes;'
  )
  cnxn = pyodbc.connect(con_str)
  </code></pre>
  
  <p>The error I'm getting is: "pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')"</p>