LAN and INTERNET differences?

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a c# program that uses an sql database. when I run
my program on my local area network, everything is fine,
my data grid loads up data. when I access the same file
through the internet, it does not work. My datagrid on
any sql functions dont work at all. The SQL connection
statment I use is :

this.sqlConnection1.ConnectionString
= "Server=AEA7FS;Database=AVRSQL;Trusted_Connection=True;"
;

I even tried substituting and ip address instead of the
server name and still my program does not work. If you
have time, please try and run it from my server...
http://69.33.85.153/tester001.exe

and you will see, after you click on the search button,
it waits a while and then says I have an invalid query.
Now if I run my program right on my local area network,
everything is fine!! Please someone enlighten me!! Thanks.
Dave
 
Dave said:
I have a c# program that uses an sql database. when I run
my program on my local area network, everything is fine,
my data grid loads up data. when I access the same file
through the internet, it does not work.
The SQL connection statment I use is :
this.sqlConnection1.ConnectionString
= "Server=AEA7FS;Database=AVRSQL;Trusted_Connection=True;"
I even tried substituting and ip address instead of the
server name and still my program does not work.

Dave,
For connections over the Internet, try something along the line of:

"Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;
Initial Catalog=myDBname;User Id=mySqlUsername;Password=mySqlPassword;"

Where
- xxx.xxx.xxx.xxx is the IP of the SQL Server machine

- 1433 is the default SQL Server port number. See Q269882 and Q287932
If you have a firewall, then that port must be open.

- Network Library=DBMSSOCN tells the Provider to use TCP/IP. See Q238949

http://www.able-consulting.com/dotnet/adonet/Data_Providers.htm#SQLClientManagedProvider

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at http://www.able-consulting.com
 
Dave,

Carl's suggested method should not be contemplated as to implement the
connection, you will - as he mentions - need to open port 1433, along with
others in you firewall.

Doing so will expose the DB Server to worm attacks along the lines of
Slammer.
Caution is prudent: Even if all your servers are patched for slammer, other
worms may be produced that may attack other ports - we can't predict the
future.

You should have as few ports open as possible at all times.

I would suggest you look into using a Virtual Private Network instead - this
is what it is for.

- Tim
 
Back
Top