Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

Connectivity with SQL6.5

We are facing connectivity problems with sql server 6.5 using OLEDB .Net provider.

can any one help us know what's the problem?
0
Suzan
Asked:
Suzan
  • 4
  • 3
1 Solution
 
naveenkohliCommented:
What errors are you getting?
0
 
SuzanAuthor Commented:
Both the below approaches work correctly with VB.Net Desktop Applications.


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objCon As New OdbcConnection()
        Try
            objCon.ConnectionString = "Driver=SQL Server;Server=SQL65;Database=Northwind;UID=sa;PWD=sa"
            objCon.Open()
        Catch o As Exception
            MsgBox(o.Message)
        End Try



    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim objCon As New OleDbConnection()
        objCon.ConnectionString = "Provider=SQLOLEDB;Data Source=SQL65; Initial Catalog=Northwind;User ID=sa;Password=sa"
        objCon.Open()

    End Sub

The below code in ASP.Net does not work

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objCon As New OdbcConnection()
        objCon.ConnectionString = "Driver=SQL Server;Server=sql65;Database=pubs;UID=sa;PWD=sa"
        objCon.Open()
        Response.Write("Connected")
    End Sub

Error Messsage Returned:


ERROR [08001] [Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionOpen (Connect()).

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.





The below code in ASP.Net does not work


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim objCon As New OleDbConnection()
        objCon.ConnectionString = "Provider=SQLOLEDB;Data Source=SQL65; Initial Catalog=pubs;User ID=sa;Password=sa"
        objCon.Open()

    End Sub


The returned Error is:
[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 36:         Dim objCon As New OleDbConnection()
Line 37:         objCon.ConnectionString = "Provider=SQLOLEDB;Data Source=SQL65; Initial Catalog=pubs;User ID=sa;Password=sa"
Line 38:         objCon.Open()
Line 39:
Line 40:     End Sub
 
What we are looking for is to connect to sql server 6.5 via ASPNet.

Thanks,
Suzan
0
 
naveenkohliCommented:
You are running into secutity issues. ASP.Net application runs under ASPNET account. Whereas desktop applications run under the logged in user account.
Unfortunately I have never used SQL6.5 so I am not sure what kind of authentication mechinism is uses and how it comuunicate swith client.
Its more of a problem with network access. Nothing to do with data provider.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
SuzanAuthor Commented:
but we are not using trusting connection mode
0
 
naveenkohliCommented:
Suzan,
So far every information I have found on this issue indicates that there is some problem with SQL Server configuration. Here is some info from another expert.. This is using DSN but gives some info on configuration of Named pipes.

*******************
Looks like the dreaded "Named Pipes" problem. Open the Control Panel ODBC applet, select your DSN,
click Configure. Click "Next" in the Config Dialog. This should take you to a screen with a "Client
Configuration" button on it. Click it. On the subsequent screen, ensure "TCP/IP" is selected. The
ODBC test at the end of setting up a DSN will work with Named Pipes (unfortunately).

Also it looks like you're using NT Authentication. This is the way to go, but you need to ensure
that your Web App runs under/connects as the account for Internet Server Anonymous access, as
defined in User Manager for Domains on the server (starts with IUSR_).
**********************

Naveen
0
 
SuzanAuthor Commented:
I put the following code in the web.config file and everything worked fine
<identity impersonate="true"/>
0
 
naveenkohliCommented:
When you turned on impersonation to true, the ASP app is running under the logged in user account. This is same as running a desk top application. Thats why it is working now. Previously you were running under ASPNET account.
0
 
gladxmlCommented:
No comment has been added lately and it seems that this question have been abandoned. So it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question or invite a Moderator to close this question if there's no reply from you after seven days.

In the absence of responses, I will recommend the following:

To accept the comment and points awarded to  naveenkohli


** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER **


Just trying to help for the cleanup...
gladxml
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now