Problems using SQLConnection for remote connection to SQL Server

  • Thread starter Thread starter Drydo
  • Start date Start date
D

Drydo

In short: --> Encountering problems connecting remotely (TCPIP) to SQL
Server using the SQLConnection.Open method and returning errors such
as "General Network Error - Check your Network Documentation" & "SQL
Server does not exist or Access is Denied". Got this far? Check out
below for the full story :)

Full Description:

OK - here's a fun one. I have a dotNET application performs a series
of interactions with a remote server, e.g. FTP and DB access. The DB
is a SQL Server configured for remote connections on a specific post,
mixed authenication, blah, blah, etc. [Note: I have a VB6 version of
this software that uses the same server utilising the same
functionality and that's fine - trust me :) ]. However, whilst
testing my dotNET application to make the remote connections - bombs
out when making the DB Connection with a variety of errors from the
SQLConnection.Open method. Examples are...

"General Network Error - Check your Network Documentation"
"SQL Server does not exist or Access is Denied"

Now here's the background...

There is nothing wrong with the SQL Server nor the Server - it handles
FTP connections fine.
The VB6 version of the software which uses exactly the same procedure
of remotely connecting to the DB - it just uses the framework and
SQLClient stuff rather than ADO.old. The only possible difference
between the VB6 and dotNET apps - is that the VB6 DB connection string
specifies the Provider, e.g. "Provider=sqloledb;"
The dotNET player was written from scratch - NO Upgrade wizards were
used.
The dotNET version can connect to the exact same server across the LAN
make the connection sequence and DB connections.

The problem occurs when trying to remotely connect to the server from
say an ISP (this knocks out the possibility of any proxy / firewall
problems on the TCPIP port) and as above, the VB6 version can do this
just fine. In addition, I'm only trying to access some Stored
Procedures that perform some SELECTs. [Note: both application use the
same authenication methods + usernames + passwords]

Now I've had a hunt around and I'll cannot find a conclusive (or
otherwise) solution to this. Some suggest setting timeouts in the
connection strings - others on the SQLCommand objects, etc. But
they've just been deadends :(. The only thing I can conclude is that
this is a dotNET and I simply don't have a clue how to proceed with
this :(

Any suggestions - Mark D
 
Hello Mark

You've tried the Net app from the same machine that the VB6 app succeeds
from?

Both errors you describe indicate that the ADO.Net application cannot find
the SQL-Server on the network. If it works fine accross the LAN but dies
when connecting through a router or firewall highly suggests that Port 1433
is blocked somewhere.


--
Ibrahim Malluf
http://www.malluf.com
==============================================
MCS Data Services Code Generator
http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
==============================================
Pocket PC Return On Investment Calculator
Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx



Drydo said:
In short: --> Encountering problems connecting remotely (TCPIP) to SQL
Server using the SQLConnection.Open method and returning errors such
as "General Network Error - Check your Network Documentation" & "SQL
Server does not exist or Access is Denied". Got this far? Check out
below for the full story :)

Full Description:

OK - here's a fun one. I have a dotNET application performs a series
of interactions with a remote server, e.g. FTP and DB access. The DB
is a SQL Server configured for remote connections on a specific post,
mixed authenication, blah, blah, etc. [Note: I have a VB6 version of
this software that uses the same server utilising the same
functionality and that's fine - trust me :) ]. However, whilst
testing my dotNET application to make the remote connections - bombs
out when making the DB Connection with a variety of errors from the
SQLConnection.Open method. Examples are...

"General Network Error - Check your Network Documentation"
"SQL Server does not exist or Access is Denied"

Now here's the background...

There is nothing wrong with the SQL Server nor the Server - it handles
FTP connections fine.
The VB6 version of the software which uses exactly the same procedure
of remotely connecting to the DB - it just uses the framework and
SQLClient stuff rather than ADO.old. The only possible difference
between the VB6 and dotNET apps - is that the VB6 DB connection string
specifies the Provider, e.g. "Provider=sqloledb;"
The dotNET player was written from scratch - NO Upgrade wizards were
used.
The dotNET version can connect to the exact same server across the LAN
make the connection sequence and DB connections.

The problem occurs when trying to remotely connect to the server from
say an ISP (this knocks out the possibility of any proxy / firewall
problems on the TCPIP port) and as above, the VB6 version can do this
just fine. In addition, I'm only trying to access some Stored
Procedures that perform some SELECTs. [Note: both application use the
same authenication methods + usernames + passwords]

Now I've had a hunt around and I'll cannot find a conclusive (or
otherwise) solution to this. Some suggest setting timeouts in the
connection strings - others on the SQLCommand objects, etc. But
they've just been deadends :(. The only thing I can conclude is that
this is a dotNET and I simply don't have a clue how to proceed with
this :(

Any suggestions - Mark D
 
You've tried the Net app from the same machine that the VB6 app succeeds
Yes - although in general the machines are specifically setup for
either dotNET or VB6. In addition, these are not developments
machines.
Both errors you describe indicate that the ADO.Net application cannot find
the SQL-Server on the network. If it works fine accross the LAN but dies
when connecting through a router or firewall highly suggests that Port 1433
is blocked somewhere.
Firstly, all machines use the same ISP so the if VB6 machines can make
the connection - then all the dotNET machines should.

In addition, the dotNET version sometimes will make the connection.
The problem is that there is NO pattern - the errors occur randomly
and successful connections are made about 20% of the time.

Thanx for the replying and I'll look forward to your comments :)
 
for .net what exact connection string are you using ?
Hi Dave,

I know I'm using the correct connection string - the application
sporadically connects and works fine, in addition, its fine when
connecting via the LAN. The only difference in the connection string
is the IP Address of the server.

Anybody else 'ever' encount this problem ?!?
 
i have used remote sql server from my local network.. which comprises of a
router and a workstation... and it does behave.. never had that issue..
 
Back
Top