Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Server does not exist or access denied

SQL Server does not exist or access denied

Scheduled Pinned Locked Moved Database
asp-netdatabasesysadmincsharpsql-server
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nikneem2005
    wrote on last edited by
    #1

    Hey guys, strange problem... when connecting to SQL Server (2000) from my WinXp (sp2) machine, i get a 'SQL Server does not exist or access denied' exception. However, when i browse to the server in the server explorer (the SQL server runs on a diffrent machine) i CAN access the server. So I dragged and dropped the connection onto my (web) form and tried to open it at Page_Load() (ASP.NET) Same problem. I know for sure my connection string is correct, I don't use integrated security, but log on with the 'sa' user and it's password. I know this user has enough rights, because I can browse the entire database needed using the server explorer as well as the enterprise manager. I think my winxp firewall blocks something, or the aspnet user (which runs the worker proces (aspnet_wp) for my website) hasn't got enough rights for network communication or so. I tried disabeling the winxp firewall without success, i'm pretty much out of solutions... anybody had this before, or knows what's going on? Thnx in advance, Eduard

    K C 2 Replies Last reply
    0
    • N nikneem2005

      Hey guys, strange problem... when connecting to SQL Server (2000) from my WinXp (sp2) machine, i get a 'SQL Server does not exist or access denied' exception. However, when i browse to the server in the server explorer (the SQL server runs on a diffrent machine) i CAN access the server. So I dragged and dropped the connection onto my (web) form and tried to open it at Page_Load() (ASP.NET) Same problem. I know for sure my connection string is correct, I don't use integrated security, but log on with the 'sa' user and it's password. I know this user has enough rights, because I can browse the entire database needed using the server explorer as well as the enterprise manager. I think my winxp firewall blocks something, or the aspnet user (which runs the worker proces (aspnet_wp) for my website) hasn't got enough rights for network communication or so. I tried disabeling the winxp firewall without success, i'm pretty much out of solutions... anybody had this before, or knows what's going on? Thnx in advance, Eduard

      K Offline
      K Offline
      kings_1
      wrote on last edited by
      #2

      Chek youer connection string see to what computer name is on to

      1 Reply Last reply
      0
      • N nikneem2005

        Hey guys, strange problem... when connecting to SQL Server (2000) from my WinXp (sp2) machine, i get a 'SQL Server does not exist or access denied' exception. However, when i browse to the server in the server explorer (the SQL server runs on a diffrent machine) i CAN access the server. So I dragged and dropped the connection onto my (web) form and tried to open it at Page_Load() (ASP.NET) Same problem. I know for sure my connection string is correct, I don't use integrated security, but log on with the 'sa' user and it's password. I know this user has enough rights, because I can browse the entire database needed using the server explorer as well as the enterprise manager. I think my winxp firewall blocks something, or the aspnet user (which runs the worker proces (aspnet_wp) for my website) hasn't got enough rights for network communication or so. I tried disabeling the winxp firewall without success, i'm pretty much out of solutions... anybody had this before, or knows what's going on? Thnx in advance, Eduard

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Well, if you are using sa just for testing access to make sure you can see the SQL Server that is fine. You shouldn't use it normally as it represents a serious security risk. If you can use the Enterprise Manager to browse to the SQL Server then the firewall isn't the problem. If you are connecting use a SQL Server account, such as sa, then the access rights of the ASPNET account are not important - they only become important if you do use Windows Integrated Security, which you aren't. In order to solve connection problems you need to understance how the ConnectionString works - relying on the IDE to generate one for you is useful only for quick throw away applications. I find that in production code it is a hinderance and causes more problems than it solves. You should examine the ConnectionString[^]that has been generated. You need to look at 4 parts specifically. These are Server (or Data Source), Database (or Initial Catalog), Password and User ID. See the linked document for more information. The Server must be set to the name of your SQL Server (this may be a named instance of SQL Server, in which case the server name is in the format MachineName/NamedInstance)


        Do you want to know more? WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums

        N 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Well, if you are using sa just for testing access to make sure you can see the SQL Server that is fine. You shouldn't use it normally as it represents a serious security risk. If you can use the Enterprise Manager to browse to the SQL Server then the firewall isn't the problem. If you are connecting use a SQL Server account, such as sa, then the access rights of the ASPNET account are not important - they only become important if you do use Windows Integrated Security, which you aren't. In order to solve connection problems you need to understance how the ConnectionString works - relying on the IDE to generate one for you is useful only for quick throw away applications. I find that in production code it is a hinderance and causes more problems than it solves. You should examine the ConnectionString[^]that has been generated. You need to look at 4 parts specifically. These are Server (or Data Source), Database (or Initial Catalog), Password and User ID. See the linked document for more information. The Server must be set to the name of your SQL Server (this may be a named instance of SQL Server, in which case the server name is in the format MachineName/NamedInstance)


          Do you want to know more? WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums

          N Offline
          N Offline
          nikneem2005
          wrote on last edited by
          #4

          My current code Try objConn.ConnectionString = "Data Source=192.168.0.1;Initial Catalog=Website;User Id=sa; Password=password;" objConn.Open() Label1.Text = "OK" Catch ex As Exception Label1.Text = ex.Message End Try Should be OK. I've got only one instance of sql server running, so that shouldn't be the problem. I tried creating a regular windows app. which runs under my local user, and still no result. At least this solved the ASPNET User Account issue. Even if I copy the connection string from the connection in my Server Explorer there's no result.. But i'm pretty sure my connectionstring is right... I know using the 'sa' user isn't a good idea in production websites, but for testing issues, i know the user has enough access rights for sure, that's why using sa at this time. I love it when a plan comes together

          N 1 Reply Last reply
          0
          • N nikneem2005

            My current code Try objConn.ConnectionString = "Data Source=192.168.0.1;Initial Catalog=Website;User Id=sa; Password=password;" objConn.Open() Label1.Text = "OK" Catch ex As Exception Label1.Text = ex.Message End Try Should be OK. I've got only one instance of sql server running, so that shouldn't be the problem. I tried creating a regular windows app. which runs under my local user, and still no result. At least this solved the ASPNET User Account issue. Even if I copy the connection string from the connection in my Server Explorer there's no result.. But i'm pretty sure my connectionstring is right... I know using the 'sa' user isn't a good idea in production websites, but for testing issues, i know the user has enough access rights for sure, that's why using sa at this time. I love it when a plan comes together

            N Offline
            N Offline
            nikneem2005
            wrote on last edited by
            #5

            What the f*ck! Created a new login, with only db owner rights on that very database and guess what, it works! I think there are some remote access problems with the sa account. However, I was testing an win app, copying and pasting the connectionstring exactly onto a webform generates the same error. I love it when a plan comes together

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups