Friday, March 23, 2012

Problems connectiong to a remote DB

Hello

I developed a vb.net win app which interacts with a sqlserver 2005 express DB.

When the DB is located in my local computer everything works just fine.

I'm trying to connect to a remote DB (mdf file that located on a remote server) but without any success.

I assume that a connectionstring change is needed, however I can't find what change to perform (I tried to insert the server IP address to the connectionstring but it didn't work either).

the app connectionstring looks like that:

connectionString

="Data Source=.\SQLExpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DBName.mdf;Integrated Security=True;User Instance=False" providerName="System.Data.SqlClient" />

Hope someone can help me find the solution.

Since your question concerns a Windows Forms application, and not ASP.NET, you should ask it on theMSDN Forums.|||Try looking atwww.connectionstrings.com...|||Hi yarit, post the connection failure error message would help to solve the issue. You can also take a look at this post:
http://forums.asp.net/thread/1289341.aspx|||

Hello

Firstly thanks for all of your replies.

Now, I've succeeded to connect my app to a remote DBbut only in my company's network, the DB is located on a different machine in the company's network and I can connect to it using this connection string:

connectionString

="Data Source=Inner network IP address \ SQLEXPRESS;Database=DBName;Uid=xxx;Pwd=yyy;"providerName="System.Data.SqlClient">

However I have no success connecting it to an outerIP address, although the machine is connected to the internet via a router and has an outerIP address.

I'll justindicate that my GUI is supposed to be accessed via the internet (a web app) so I must be able to connecteventually via an outer IP address.

Does anybody know if I need to change some config or if it is a pure network problem.

|||

Hello

Firstly thanks for all of your replies.

Now, I've succeeded to connect my app to a remote DBbut only in my company's network, the DB is located on a different machine in the company's network and I can connect to it using this connection string:

connectionString

="Data Source=Inner network IP address \ SQLEXPRESS;Database=DBName;Uid=xxx;Pwd=yyy;"providerName="System.Data.SqlClient">

However I have no success connecting it to an outerIP address, although the machine is connected to the internet via a router and has an outerIP address.

I'll justindicate that my GUI is supposed to be accessed via the internet (a web app) so I must be able to connecteventually via an outer IP address.

Does anybody know if I need to change some config or if it is a pure network problem.

|||Hi yairt, first of all you have to make sure on teh SQL box no firewall is blocking TCP/IP communication to the SQL Express service from Internet. You can use telnet to check this, please refer to the post I mentioned in my previous post.|||

hi Iori jay

thanks for your reply.

The problem was solved (or better said was by-passed), apparently it has nothing to do with SQLSERVER or connection strings.

We connected the server to the internet via ADSL line (`and not through a router that probably concealed its address) and everything worked just fine.

No comments:

Post a Comment