Dear All,

G

Guest

Dear All,

I have tried to access a SQL server DB on on network A from ASP/Or ASP.Net
Application
Which is hosted on another network domain,
Both of them are behind the firwall (all consideraation are fixed,..),
IIS server can connect to SQL-Servers, using:
SQL-Analyzer or
Enterprize manager or
VB6 desktop application hosted on (IIS) server using ADODB or
VC# Desktop application,...

But when the story comes to Acccesing SQL-Server from ISS using either ASP
or ASP.Net The following error:
"SQL Server does not exist or access denied"

Is this logical, is there a way to overcome, this problem.
I have tried a looked into many links and previous experments and did all
workarouunds listed on MSISDN, but still the same problem.
 
G

Guest

How are you trying to connect? What's the conenction string? Are you using
Integrated Security or SQL Server Secuirity? Can you connect using teh same
conenction parameters using Query Analyzer ?
 
G

Guest

I have tried all type on connection string listed in the world.
Including the Connection string used by Database projects on ASP.Net, and
Data envirmennts on VB6, and ODBC and UDL,....
 
K

Kevin Spencer

Okay, let's start with terminology. The IIS Server doesn't connect to
anything other than a network. It's an Operating System. Now, what IS
connecting is:

Query Analyzer
Enterprise Manager
VB6 Desktop app

All three of the applications mentioned are executables, which means that
they run under the machine's System account.

On the other hand, your ASP.Net app runs under a different account. Chances
are it runs under the default ASP.Net account, which is extremely
underpriveleged.

Okay, now, SQL Server can be connected to in one of 2 different ways:

Windows Authentication
Mixed Windows and SQL Server Authentication

When using Windows Authentication only, only Windows accounts that have been
granted the necessary database permissions can access the database. When
using Mixed mode, SQL Server accounts can also access the SQL Server,
according to the priveleges that they have been granted IN SQL Server.

So, if you're using Windows Auth only, your connection string should reflect
that, and the ASP.Net user account must be granted the necessary
permissions.

If you're using Mixed mode, the connection string should contain the name
and password of the SQL Server account that has been granted the
permissions.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Did any of them work ok from Query analyzer, or some other tool running on
same machine? If not, you have no guarantee that they will work from code..
 
G

Guest

To clarify,
Server 1
I have SQL-Server only- Remote server which allows Mixed mode behind the
firewall.

Server 2:
And IIS + SQL server,... query analyzer, VB 6, ,... All begined th firewall.

Trying to establish connection from 2 to 1.
All connnections success Except ASP.Net/ASP
The connection string: all are baesd on (IP,Port) and (UID,PWD)(SQL User on
Server1), and other requiered parameters,...

This is may simplyfy the story>
 
M

Michael C#

Post your connection string.

Shaker said:
I have tried all type on connection string listed in the world.
Including the Connection string used by Database projects on ASP.Net, and
Data envirmennts on VB6, and ODBC and UDL,....
 
G

Guest

Please check my last response to Keiven.

CBretana said:
Did any of them work ok from Query analyzer, or some other tool running on
same machine? If not, you have no guarantee that they will work from code..
 
M

Michael C#

Let me make sure I understand your issue.

You have two boxes:

Box A has SQL Server,
Box B has ASP.NET apps and IIS

You can reach Box A (SQL Server) from Box B via Enterprise Manager and Query
Analyzer, but not from ASP.NET apps.

Is this correct?
 
K

Kevin Spencer

Well, if you're still having problems, post the Connection String.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

"Driver={SQL
Server;Server=IP;Address=IP,port;Network=DBNETLIB;Database=DBNAME;Uid=sqlLogin;Pwd=pppp"
or

"DSN=DSNNAme;UID=sqlLogin;PWD=pppp"

or

"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;User ID=sqllogin;Data Source=tcp:ip,port;Pwd=ppp"

or
"Provider=MSDASQL.1;Password=ppp;Persist Security Info=True;User
ID=sqllogin;Data Source=IP,port;Initial Catalog=DBNAme

...
...
...
...
Ther is still many
 
G

Guest

Try Using this in your code...

Public Function GetConnectionString( ByVal sServer As String, _
ByVal sDatabase As String, ByVal sUserID As String, _
ByVal sPassword As String) As String

' ********** ADO Connection String ************
GetConnectionString = "Data Provider=SQLOLEDB;" & _
"Persist Security Info=False;" & _
"Data Source=" & sServer & _
";User ID=" & sUserID & _
";Password=" & sPassword & _
";Initial Catalog=" & sDatabase
End Function
' ---------------------------------------------------------

And Pass the <Server Name> in the sServer field...
IS THE SQL Server using port 1433 (the default) ??
Or some other custom Port Number ?
If it's using anything other than 1433, then you have to pass that:
as sServer = "SQLSERVERNetBiosName:nnnn" Where nnnn = port number, or
sServer = "IPADDRESS:nnnn" like "192.168.65.201:1455"
 
M

Michael C#

Good lawd. Looks like your connection string from here. Try this one
(OleDb):

"Provider=SQLOLEDB;Data Source=xxx.xxx.xxx.xxx,nnn;Initial
Catalog=DBNAME;User ID=sqlLogin;Password=pppp;"

If you're using Integrated Security, then you need to get rid of User ID=
and Password= and add "Integrated Security=SSPI;". I think you specified
SQL Server security, however.


Shaker said:
"Driver={SQL
Server;Server=IP;Address=IP,port;Network=DBNETLIB;Database=DBNAME;Uid=sqlLogin;Pwd=pppp"
or

"DSN=DSNNAme;UID=sqlLogin;PWD=pppp"

This is for an ODBC-style connection with a DSN set up.
 
M

Michael C#

I wouldn't swear to it, but I think if you have a custom port (other than
1433), it has to be separated from your IP address or server name by a comma
(",") as opposed to a colon (":") in the connection string. I could be
wrong on that though...
 
G

Guest

I'll try by tommorow,..

CBretana said:
Try Using this in your code...

Public Function GetConnectionString( ByVal sServer As String, _
ByVal sDatabase As String, ByVal sUserID As String, _
ByVal sPassword As String) As String

' ********** ADO Connection String ************
GetConnectionString = "Data Provider=SQLOLEDB;" & _
"Persist Security Info=False;" & _
"Data Source=" & sServer & _
";User ID=" & sUserID & _
";Password=" & sPassword & _
";Initial Catalog=" & sDatabase
End Function
' ---------------------------------------------------------

And Pass the <Server Name> in the sServer field...
IS THE SQL Server using port 1433 (the default) ??
Or some other custom Port Number ?
If it's using anything other than 1433, then you have to pass that:
as sServer = "SQLSERVERNetBiosName:nnnn" Where nnnn = port number, or
sServer = "IPADDRESS:nnnn" like "192.168.65.201:1455"
 
G

Guest

Shaker,

I have my old ADO 2.7 reference book, and it does npt explicitly mention
the correct syntax for adding (non-Default) port number, so Michael C# could
be right...
If this IS your situation, try it with both the colon <:>, AND wit hthe
comma <,> , One of those should definitely work...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top