Re: Connect to SQL 2005 database on local network fails



Hi Gary, hope you haven't pulled your hair out just yet. Hopefully,
i'll be able to be of some assistance. I must admit that i only
browsed your post, but after looking at your remote connection string I
have a feeling i know what your problem is.

I was having the same issue recently when i was trying to connect to a
named instance of SQL Server Express. My connection string looked
something like the following:

return @"Server=" + RemoteServerName + "\" + RemoteInstance + ";user id
= " + UserName + "; password = " + Password + "; database = " +
RemoteDatabaseName + ";";

It turns out that when this is executed in a normal desktop environment
a UDP broadcast occurs that identifies which port the named instance is
listening on. However, this broadcast doesn't make it out to the
network when running on the device (something about either the device,
ActiveSync, or possibly both not understanding UDP). Furthermore, if
you've poked around this newsgroup enough, you'll notice that plenty of
these connection issues end up being resolved by simply identifying and
using the correct port number to connect to the database server.

Therefore, I modified my connection string to look like this:

return @"Server=" + RemoteServerName + ", " + portNumber + ";user id =
" + UserName + "; password = " + Password + "; database = " +
RemoteDatabaseName + ";";

(notice that i have used portNumber now so that Server becomes
something like "Sever = serverName, 4567")

To identify exactly which port you are using you can use the following
process:
1. Right click on My Computer
2. Select Manage
3. Expand the Services and Applications Tree
4. Expand the SQL Server Configuration Manager Tree
5. Expand the SQL Server 2005 Network Configuration Tree
6. Select Protocols for SQLExpress

(At this point in time you should ensure that TCP/IP is enabled. if it
is not Enable it by right-clicking, but remember that you will have to
restart the server for the changes to take effect)

7. Right click TCP/IP and choose properties
8. Select the IP Addresses tab
9. I've chosen to use dynamic ports, so all of the TCP Dynamic Ports
are set to 0 except for the last one in IPALL. There it has defaulted
to 1026 which is good for me and the one that I am using. If you make
a different decision, just ensure that you identify at this point which
port number you are listening to.

Finally, ensure that your connection string in code is modified to use
the port number you identified.

That exhausts my understanding of the problem at this point in time.
Hope it helps, and happy coding. ;)

- jimmy

.



Relevant Pages

  • Re: Connect to SQL 2005 database on local network fails
    ... but after looking at your remote connection string I ... using the correct port number to connect to the database server. ... Expand the SQL Server Configuration Manager Tree ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Connect to SQL 2005 database on local network fails
    ... but after looking at your remote connection string I ... using the correct port number to connect to the database server. ... Expand the SQL Server Configuration Manager Tree ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Connect to SQL 2005 database on local network fails
    ... but after looking at your remote connection string I ... using the correct port number to connect to the database server. ... Expand the SQL Server Configuration Manager Tree ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Connect to SQL 2005 database on local network fails
    ... ActiveSync doesn't forward UDP packets. ... but after looking at your remote connection string I ... using the correct port number to connect to the database server. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Connect to SQL 2005 database on local network fails
    ... but after looking at your remote connection string I ... using the correct port number to connect to the database server. ... Expand the SQL Server Configuration Manager Tree ...
    (microsoft.public.dotnet.framework.compactframework)

Loading