I have a NAnt-based script which that I run on my local PC that connects to SQL Server 2008 Express also running on my local PC to drop and recreate databases using .sql files - this works fine, no problem here.
The problem comes when I have recreated the same set-up on another PC, I get the error in my NAnt script saying that:
System.InvalidOperationException: The 'SQLNCLI' provider is not registered on the local machine.
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
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 NAnt.Contrib.Util.SqlHelper..ctor(String connectionString, Boolean useTransaction)
at NAnt.Contrib.Tasks.SqlTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
I have searched online and have found that in a forum it was suggested that I needed to install the Microsoft SQL Server Native Client, and got it from this URL. (Admittedly, I have only installed the Native Client part of this)
Despite this being installed on my second PC, the script still gives me the same error. Any suggestions?
In addition to installing SQL Server Native Client as part of the SQL Server installation, there is also a redistributable installation program named sqlncli. msi, which can be found on the SQL Server installation disk in the following location: %CD%\Setup\ . You can distribute SQL Server Native Client through sqlncli.
The OLE DB Driver for SQL Server is a stand-alone data access application programming interface (API), used for OLE DB, that was introduced in SQL Server 2005 (9. x). OLE DB Driver for SQL Server delivers the SQL OLE DB driver in one dynamic-link library (DLL).
It is deprecated, but still supported some versions.
To determine the version of SQL Server Native Client, use one of the following methods: Method 1: On the system where you want to find the version of Native Client, start the ODBC Administrator (odbcad32.exe), and then check the Version column under the Drivers tab.
The correct provider for SQL Server 2008 is SQLNCLI10.1
.
For SQL Server 2012, that would be SQLNCLI11
. (source)
Sadly, the migration to 2008 did not pick up the change...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With