OleDbConnection problem. Opens when a service starts

We have a Nant build script that we run through SSH (Cygwin and Open SSH) to remotely update our databases. When a Nant script is launched through an SSH session, the following error occurs when trying to make a connection to the database. However, if I log into the server directly (using the same account as the service) and run the Nant scripts manually, the script runs successfully.

Error message:

System.InvalidOperationException: .Net Framework Data Providers require Microsoft Data Access Components (MDAC). Please install Microsoft Data Access Components (MDAC) version 2.6 or later. ---> System.IO.FileNotFoundException: getting COM factory class for components with CLSID {} ​​2206CDB2-19C1-11D1-89E0-00C04FD7A829 failed due to the following error: 8007007e.

Stack trace:

System.InvalidOperationException: The .Net Framework Data Providers require Microsoft Data Access Components(MDAC). Please install Microsoft Data Access Components(MDAC) version 2.6 or later.
---> System.IO.FileNotFoundException: Retrieving the COM class factory for component with CLSID {2206CDB2-19C1-11D1-89E0-00C04FD7A829} failed due to the following error: 8007007e.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Data.OleDb.OleDbConnectionInternal.CreateInstanceDataLinks()
at System.Data.OleDb.OleDbConnectionInternal.GetObjectPool()
--- End of inner exception stack trace ---
at System.Data.OleDb.OleDbConnectionInternal.GetObjectPool()
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at UpgradeDatabases.UpgradeDatabase.Execute()

After spending a lot of time trying to track down the cause, I got stuck. Here are some comments I made:

  • The script works fine when I run it manually on the same computer (without SSH). I can even run the script manually, with the same user that the SSH service is working with.
  • Since the Nant script runs under the service context, the problem seems to be related to the user profile.
  • script Windows 2008 Server .NET 3.5. , MDAC ,
  • , UPHClean ( Windows Server 2008). , . Event Viewer ID 1530 , script.
  • OleDb SQL Server 2008 .

- , ? , . Procmon, , . !

+3
3

Cygwin + OpenSSH. WinSSHD, . Cygwin + OpenSSH, Windows Server 2008. , !

+1

" .Net Framework Microsoft Data Access Components (MDAC). Microsoft Data Access (MDAC) 2.6 ". Windows ssh, cygwin (Windows Server 2008 R2 Enterprise). , openssh cygwin. , , ssh-:

CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files

, :

$ ssh myuser@myserver -o SendEnv='CommonProgramFiles(x86)'

. , , sshd , . , /etc/sshd _config, sshd (net stop sshd, net start sshd):

AcceptEnv CommonProgramFiles(x86)

AccessDatabaseEngine.exe(Microsoft Office Access engine engine 2007) ( http://www.microsoft.com/en-us/download/confirmation.aspx?id=23734), C:\Program Files (x86)\Common Files.

+2

Windows 7 + OpenSSH (OpenSSH_6.5p1, OpenSSL 1.0.1f 6 2014 .) #, Access.

export CommonProgramFiles="C:\Program Files\Common Files"

/etc/profile.

.

0

Source: https://habr.com/ru/post/1765295/


All Articles