Can't connect to DB

Discussion in 'ASP .Net Security' started by Sandy, Oct 21, 2003.

  1. Sandy

    Sandy Guest

    Hi!

    I am trying to open a connection to a SQL Server database
    using just the Framework, Notepad and the browser. I keep
    getting the error message "SQL Server does not exist or
    access is denied."

    I am using the following for the connection:

    Dim conPubs As SqlConnection
    ConPubs = New SqlConnection ("Data
    Source=localhost;Initial Catalog=PUBS;Integrated
    Security=SSPI;")
    ConPubs.Open()

    In Page_Load of the script. I can take the same notepad
    aspx page and put it into Visual Studio .NET and it
    connects without a problem.

    I'm using Windows Server 2003 and my SQL Server 2000 is
    set up with windows authentication. I am not on a
    network - just studying this stuff on my home computer.

    THIS IS DRIVING ME CRAZY! I have read many many pages on
    security and nothing seems to be giving me what I need. I
    would guess on some level there is probably some stupid
    little box that has to be checked or unchecked . . . Where
    ever that could be . . .

    Any help anyone can give me will be immensely appreciated!

    Sandy
     
    Sandy, Oct 21, 2003
    #1
    1. Advertising

  2. Hi,
    have you tried with this connection string?
    "Data Source=local;Initial Catalog=PUBS;Integrated Security=SSPI;"

    I changed the "Data Source=localhost" with "Data Source=local".

    Andrea

    "Sandy" <> wrote in message
    news:0a5001c39811$47c00b60$...
    > Hi!
    >
    > I am trying to open a connection to a SQL Server database
    > using just the Framework, Notepad and the browser. I keep
    > getting the error message "SQL Server does not exist or
    > access is denied."
    >
    > I am using the following for the connection:
    >
    > Dim conPubs As SqlConnection
    > ConPubs = New SqlConnection ("Data
    > Source=localhost;Initial Catalog=PUBS;Integrated
    > Security=SSPI;")
    > ConPubs.Open()
    >
    > In Page_Load of the script. I can take the same notepad
    > aspx page and put it into Visual Studio .NET and it
    > connects without a problem.
    >
    > I'm using Windows Server 2003 and my SQL Server 2000 is
    > set up with windows authentication. I am not on a
    > network - just studying this stuff on my home computer.
    >
    > THIS IS DRIVING ME CRAZY! I have read many many pages on
    > security and nothing seems to be giving me what I need. I
    > would guess on some level there is probably some stupid
    > little box that has to be checked or unchecked . . . Where
    > ever that could be . . .
    >
    > Any help anyone can give me will be immensely appreciated!
    >
    > Sandy
    >
     
    Andrea D'Onofrio, Oct 22, 2003
    #2
    1. Advertising

  3. Sandy

    Sandy Guest

    Hi Andrea!

    Thanks for replying.

    I did find out what the problem was from Chris at
    the .framework.adonet site. Turns out there were two
    things wrong - I had to:

    1. Switch off anonymous access on Directory Security tab
    in IIS (the I_User part), click okay.
    Go back to Directory security. It now reads "Use the
    following Windows user account . . . with reference to the
    Windows user name and password. Check box in front of
    Enable Anonymous Access.
    2. Insert <identity impersonate="true" /> in xml page.

    Thought I would include this in case you come across it in
    the future, you can pass the word on to dummies like me.

    Thanks again.

    Sandy

    >-----Original Message-----
    >Hi,
    >have you tried with this connection string?
    >"Data Source=local;Initial Catalog=PUBS;Integrated

    Security=SSPI;"
    >
    >I changed the "Data Source=localhost" with "Data

    Source=local".
    >
    >Andrea
    >
    >"Sandy" <> wrote in

    message
    >news:0a5001c39811$47c00b60$...
    >> Hi!
    >>
    >> I am trying to open a connection to a SQL Server

    database
    >> using just the Framework, Notepad and the browser. I

    keep
    >> getting the error message "SQL Server does not exist or
    >> access is denied."
    >>
    >> I am using the following for the connection:
    >>
    >> Dim conPubs As SqlConnection
    >> ConPubs = New SqlConnection ("Data
    >> Source=localhost;Initial Catalog=PUBS;Integrated
    >> Security=SSPI;")
    >> ConPubs.Open()
    >>
    >> In Page_Load of the script. I can take the same notepad
    >> aspx page and put it into Visual Studio .NET and it
    >> connects without a problem.
    >>
    >> I'm using Windows Server 2003 and my SQL Server 2000 is
    >> set up with windows authentication. I am not on a
    >> network - just studying this stuff on my home computer.
    >>
    >> THIS IS DRIVING ME CRAZY! I have read many many pages

    on
    >> security and nothing seems to be giving me what I

    need. I
    >> would guess on some level there is probably some stupid
    >> little box that has to be checked or unchecked . . .

    Where
    >> ever that could be . . .
    >>
    >> Any help anyone can give me will be immensely

    appreciated!
    >>
    >> Sandy
    >>

    >
    >
    >.
    >
     
    Sandy, Oct 22, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Otis Mukinfus
    Replies:
    3
    Views:
    924
    Juan T. Llibre
    Jul 8, 2005
  2. Replies:
    3
    Views:
    40,283
    Roedy Green
    Nov 16, 2005
  3. Replies:
    2
    Views:
    288
  4. Mohsen Pahlevanzadeh

    Qt connect and first connect or unicode

    Mohsen Pahlevanzadeh, Sep 17, 2013, in forum: Python
    Replies:
    3
    Views:
    155
    Mohsen Pahlevanzadeh
    Sep 18, 2013
  5. Mohsen Pahlevanzadeh

    Re: Qt connect and first connect or unicode

    Mohsen Pahlevanzadeh, Sep 17, 2013, in forum: Python
    Replies:
    0
    Views:
    120
    Mohsen Pahlevanzadeh
    Sep 17, 2013
Loading...

Share This Page