[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Hi,
I have a build machine with 64 bit Windows 7 and MSoffice 2013 64bit installed on machine. My MSTest project(.NET) have [DataSource("ExcelDataSource"), TestMethod] defined on a test method. The test runs succefully when i run the test within visual studio 2013 on the same build agent machine. but when i run the build from within teamcity Datasource name not found error pops up. The entry in my test project's app.config is like this
<configSections>
<section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</configSections>
<connectionStrings>
<add name="ExcelConn" connectionString="Dsn=smt;Driver={Microsoft Excel Driver (*.xls,*.xlsx,*.xlsm,*.xlsb)};dbq=G:\TestParams.xls;defaultdir =.; driverid=790;maxbuffersize=2048;pagetimeout=5" providerName="System.Data.Odbc"/>
</connectionStrings>
<microsoft.visualstudio.testtools>
<dataSources>
<add name="ExcelDataSource" connectionString="ExcelConn" dataTableName="Sheet1$" dataAccessMethod="Sequential"/>
</dataSources>
</microsoft.visualstudio.testtools>
I have created smt dsn from C:\Windows\SysWOW64 folder and it is visible in both 32 bit and 64 bit ODBC. using teamcity 9.1.1 version . tried with platfor x86 and x64 in buildsettings with same result.part build log is attched.
Any help would be really appreciated.
Thanks
Sudheesh
Attachment(s):
Media3_Build_31.log.zip
Please sign in to leave a comment.
Hello,
Do you see the same result if you run the same build using vstest.console.exe from command line and not under TeamCity? Please follow the steps described in this guideline.
Hi,
Yes the test works fine in Visual studio console.I ran the following commands in visual studio command prompt
C:\Program Files (x86)\Microsoft Visual Studio 12.0>vstest.console.exe C:\TeamCity\buildAgent\work\9f226e29edc8c261\UnitTests\DataFeedServiceTest\DataFeedServiceUnitTest\bin\CI\DataFeedServiceUnitTest.dll /Platform:x86 /Logger:TeamCity
The result was successfull run (attached Screenshot).
I have doen further analysis on this based on the link you shared(troubleshooting) and managed to solve the issue by,
1) Stopping the windows service and running them from command promp-Resulted in Successfull test run
2) Running the service and setting Log on user as the same same user login to the system with admin previleges in local system.
I guess in the documentation section of Windows service should updated with to recomend users to change the properties and set the Logon user at installation/configuration step iteself
Thank you once again for pointing towards right trouble shooting steps
Thanks and Regards
Sudheesh
Message was edited by: sudheesh pm to update the resolution step
Attachment(s):
vstest-consol.png
Running the Team city Windows service and Team city Build agent service with a specific user Credentials-who has admin privileges (service->properties->Log on-Specified User) solved the problem.