Thursday, March 8, 2012

Connection fails during unit test

Hi
I am having trouble with a connection within our local network. A
development machine needs to connect to the main dev db server. Visual
Studio and Enterprise Manager on the dev machine connect fine. The
application under development connects fine when it is run with the
connection string
"Data Source=[servername]; Initial Catalog=[dbName];
Trusted_Connection=yes;"
The application also connects nicely using a named login and password.
My problem is, when we run unit tests with NUnit on a remote machine the
connection attempt returns 'Sql Server does not exist or access denied'
with the same connection string. We have completely turned off all
firewalls etc to no avail.
Any Ideas?
Thanks
Graham
Have the remote machine test connecting with a new ODBC DSN. Press the
Test
button on the ODBC Wizard and report the OS error returned. Since the
machine is remote,
it could be a problem with name resolution.
Ex. 11001 == HostNameNotFound == DNS/WINS issue.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||Kevin McDonnell [MSFT] wrote:

> Have the remote machine test connecting with a new ODBC DSN. Press the
> Test
> button on the ODBC Wizard and report the OS error returned. Since the
> machine is remote,
> it could be a problem with name resolution.
> Ex. 11001 == HostNameNotFound == DNS/WINS issue.
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
Thanks for the reply Kevin...
I have tried the ODBC wizard and the connection works fine. As I said I
have no problem connecting from the remote machine using Enterprise
Manager and Visual Studio, it is just the NUnit tests that can't access
the db server.
Thanks again
Graham
|||"when we run unit tests with NUnit on a remote machine the
connection attempt returns 'Sql Server does not exist or access denied'
with the same connection string. "
I would run network traces to determine where the problem is. You need to
validate
that the tcp connection is being made and the connection string is correct.
An ODBC trace won't show
you this level of detail.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||Kevin McDonnell [MSFT] wrote:
> "when we run unit tests with NUnit on a remote machine the
> connection attempt returns 'Sql Server does not exist or access denied'
> with the same connection string. "
> I would run network traces to determine where the problem is. You need to
> validate
> that the tcp connection is being made and the connection string is correct.
> An ODBC trace won't show
> you this level of detail.
>
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
Thanks again Kevin
My networking knowledge is a little lacking I'm afraid. Could you give
me some pointers on how I would go about running 'network traces'.
Thanks
Graham
|||SQL Server is a Winsock application. So the 2nd article will help you
understand what to look for.
If you need more help you can always open up a support case.
Windows 2000 Server has netmon installed . You just need to enable it via
Add/Remove Windows components.
This version captures traffic to and from that machine. Only SMS has the
full version to capture traffic on any machine.
Q148942 How to Capture Network Traffic with Network Monitor
Q169292 The Basics of Reading TCP/IP Traces
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

No comments:

Post a Comment