title: Can not open database from odbc connection(using dsn) using windows service?
body: <p>I am creating windows service which will connect to database using ODBC DSN, not using any username/password.
  Windows service is set as LocalService. (And I tried changing it to Netwrok Service as well as LocalSystem)
  I am using ODBC DSN as I will have different types of database (Sqlite,Sql,MySQl etc.).
  At moment I am getting below error:</p>
  
  <pre><code>ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "EmployeeDb" requested by the login. The login failed.
  ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "EmployeeDb" requested by the login. The login failed.
  StackTrace:    at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
     at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
     at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
     at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
     at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)
     at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
     at System.Data.Odbc.OdbcConnection.Open()
  </code></pre>
  
  <p>Here is my code for connect odbc using dsn name</p>
  
  <pre><code> var conn = new OdbcConnection(@"DSN=Employee");
   conn.Open();
   conn.Close();
  </code></pre>