Sql Ole problem with Sql 6.5

T

Thomas Scheiderich

I get an error from trying to connect to my Sql6.5 server (which is why
I am using Ole). It says the server doesn't exist or the password is
wrong. I can't understand that because I use essetially the same
connection scripts on my ASP pages and it works fine.

Here is my ASP connection that works fine:

*****************************************************************
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout = 60
connectionToDatabase.Open "Provider=sqloledb;data source=steg;" & _
"initial catalog=travdata;" & _
"user id=sa;password="
*****************************************************************

Here is my aspx page (essentially):

*****************************************************************
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script runat="server">
Dim ConnectString, SelectStatement As String
Dim Connect As OleDbConnection = New OleDbConnection
Dim Adapter As OledbDataAdapter = New OleDbDataAdapter
Dim CmdBuilder As OleDbCommandBuilder
Dim ds As DataSet = New DataSet
Dim Row As DataRow

Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
SelectStatement = "Select * From carriers"
ConnectString = "Provider=SQLOLEDB;Data Source=steg;Initial
Catalog=travdata;uid=sa;pwd="
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = _
new OleDbCommand(SelectStatement, Connect)
CmdBuilder = New OleDbCommandBuilder(Adapter)
Adapter.Fill(ds,"carriers")
end if
end sub
</script>
*****************************************************************

The error I get is:

*****************************************************************
Server Error in '/' Application.
--------------------------------------------------------------------------------

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.

Source Error:


Line 41: new OleDbCommand(SelectStatement, Connect)
Line 42: CmdBuilder = New OleDbCommandBuilder(Adapter)
Line 43: Adapter.Fill(ds,"carriers")
Line 44: end if
Line 45: end sub


Source File: c:\inetpub\wwwroot\itineraryTS.aspx Line: 43

Stack Trace:


[OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL
Server does not exist or access denied.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
ASP.itineraryTS_aspx.Page_Load(Object Sender, EventArgs E) in
c:\inetpub\wwwroot\itineraryTS.aspx:43
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
*****************************************************************

The problem seems to be a problem with Sql 6.5 as if I change

"Source=steg" to "Source=(local)" or "Source=allosaurus"

Both the local and Allosaurus remote server are running Sql 7.0.

This was the reason I didn't use SqlConnection because I was using 6.5
and I was told that SqlConnection only worked with 7.0 and above. If I
was going to use 6.5, I needed to use OLE, which I did.

Obviously, the machine is seeing it as my ASP page works.

I know the server exists and so does the access to the server. What am
I missing?

Thanks,

Tom.
 
C

Cowboy \(Gregory A. Beamer\)

Check the client side libraries on the ASP.NET machine versus the ASP
machine (if same, kick this idea). You will need to move away from named
pipes, if that is what you are using. This would work under ASP, but not
ASP.NET.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q315159

NOTE: When you add the network lib to the conn string, you will also have to
ensure that network lib is installed on the SQL Server. Some 6.5
installations only had named pipes installed. If this is the case, you will
not be able to use .NET with your server unless you add other libraries. The
Server networking tool can show you what is installed. You may also have to
reorder the network libs to take named pipes off the top of the list. Be
careful, as this may break ASP apps (test during non-critical times and
regression test).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
Thomas Scheiderich said:
I get an error from trying to connect to my Sql6.5 server (which is why
I am using Ole). It says the server doesn't exist or the password is
wrong. I can't understand that because I use essetially the same
connection scripts on my ASP pages and it works fine.

Here is my ASP connection that works fine:

*****************************************************************
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout = 60
connectionToDatabase.Open "Provider=sqloledb;data source=steg;" & _
"initial catalog=travdata;" & _
"user id=sa;password="
*****************************************************************

Here is my aspx page (essentially):

*****************************************************************
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script runat="server">
Dim ConnectString, SelectStatement As String
Dim Connect As OleDbConnection = New OleDbConnection
Dim Adapter As OledbDataAdapter = New OleDbDataAdapter
Dim CmdBuilder As OleDbCommandBuilder
Dim ds As DataSet = New DataSet
Dim Row As DataRow

Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
SelectStatement = "Select * From carriers"
ConnectString = "Provider=SQLOLEDB;Data Source=steg;Initial
Catalog=travdata;uid=sa;pwd="
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = _
new OleDbCommand(SelectStatement, Connect)
CmdBuilder = New OleDbCommandBuilder(Adapter)
Adapter.Fill(ds,"carriers")
end if
end sub
</script>
*****************************************************************

The error I get is:

*****************************************************************
Server Error in '/' Application.
-------------------------------------------------------------------------- ------

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.

Source Error:


Line 41: new OleDbCommand(SelectStatement, Connect)
Line 42: CmdBuilder = New OleDbCommandBuilder(Adapter)
Line 43: Adapter.Fill(ds,"carriers")
Line 44: end if
Line 45: end sub


Source File: c:\inetpub\wwwroot\itineraryTS.aspx Line: 43

Stack Trace:


[OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL
Server does not exist or access denied.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
ASP.itineraryTS_aspx.Page_Load(Object Sender, EventArgs E) in
c:\inetpub\wwwroot\itineraryTS.aspx:43
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
*****************************************************************

The problem seems to be a problem with Sql 6.5 as if I change

"Source=steg" to "Source=(local)" or "Source=allosaurus"

Both the local and Allosaurus remote server are running Sql 7.0.

This was the reason I didn't use SqlConnection because I was using 6.5
and I was told that SqlConnection only worked with 7.0 and above. If I
was going to use 6.5, I needed to use OLE, which I did.

Obviously, the machine is seeing it as my ASP page works.

I know the server exists and so does the access to the server. What am
I missing?

Thanks,

Tom.
 

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

Top