SQL Server does not exist or access denied
-
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
-
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
-
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
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
(orData Source
),Database
(orInitial Catalog
),Password
andUser 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 formatMachineName/NamedInstance
)
Do you want to know more? WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
-
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
(orData Source
),Database
(orInitial Catalog
),Password
andUser 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 formatMachineName/NamedInstance
)
Do you want to know more? WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
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
-
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
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