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.
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()
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, , . !