Solved

SQL Server does not exist or access denied?

Posted on 2003-11-06
12
54,281 Views
Last Modified: 2011-08-18
I created a SQL server instance called 'Instance'. In the databases, I created a database called 'DB'. I selected "use the local system account". Authentication mode is "Windows Authentication mode".

Is the following connection string correct?

String connString="server=Instance; database=DB; uid=sa; password=;";   (Should instance be replaced with localhost? Should I replace the uid and password?)

Why am I getting this error message:
"SQL Server does not exist or access denied"?

Thanks.
0
Comment
Question by:samliam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
12 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 9693250
First of all:
Does sa have permissions on 'DB'?

Second (obvious one): Is SQL Server up and running when you this?

Third:
Try accessing the server by it's IP:
String connString="server=(local); database=DB; uid=sa; password=;";
or
String connString="server=127.0.0.1; database=DB; uid=sa; password=;";
or any other IP.

D'Mzz!
RoverM
0
 

Expert Comment

by:Orbitalgr
ID: 9693271
If when your are browsing your sql server, the name of the instance (under the SQL server group) is Instance don't change it to (Local) or anything. Try this one instead:

connString="server=Instance; initial catalog=DB; uid=sa; pwd=;"

PS
If it doesn't work that way either.
1) R u sure your SQL server is running?
2) The sa passward is blank?

Hope i was helpfull,

Orbital.
0
 
LVL 42

Accepted Solution

by:
frodoman earned 25 total points
ID: 9693687
With the connection string you're sending, you probably want the connection mode set to SQL Server validation instead of Windows (otherwise there's no point in sending the sa user in your string...)

If you keep your authentication Windows based, then you need to make sure that the Windows user has the appropriate access rights for whatever you're trying to do.

I would also consider changing your server name to "(local)\Instance".  Orbital is right that you *probably* don't need to, but if there's another "Instance" on your cluster you potentially have a problem.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Assisted Solution

by:Orbitalgr
Orbitalgr earned 25 total points
ID: 9693882
frodoman is right :) I didn't notice that you use windows authentication mode.
You don't need to provide uid and pwd in such a case. Try connecting to your database with a trusted connection like:
connString= "Data Source=Instance;Initial Catalog=DB;Integrated Security=SSPI;"
If i doesn't work that way, follow frodoman advice by giving as a data source the: "serverName\Instance Name"
I am not sure but I think that this one applies only to Sql Server 2000.

Good Luck
Orbital.
0
 

Author Comment

by:samliam
ID: 9697292
How do I add a user to the db? 'sa' is reserved, but I do not see it in the list. When I try to add a different user, it says "login already exists."
0
 

Author Comment

by:samliam
ID: 9698773
SQL Server Enterprise Manager, if I expand Databases\myDB, click on 'Users', there is only 1 item: "dbo".
If I double-click "dbo", a 'databse user property dialog' shows. In Permit in databse role, only 'public' is checked. If I click "permission", myTable has all select, insert, etc checked (except for EXEC).

If I right-click 'dbo' ->New Databse User, I cannot add 'sa', it is 'reserved.' I cannot add my Windows account, it says 'already exists.'

What do I do?
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9700797
Samliam,

I think what you want is to drill into Security -> Logins instead of Database -> Users.

Try this and you should see the Windows account that you you're trying to add already exists.  Right-Click and then set the access permissions as necessary.

I would still recommend that instead of doing this you change your access validation to SQL Server and connect as you were trying in your original post.  Windows validation can be more difficult to troubleshoot so I'd get an SA connection working first and then move to Windows validation if that's where you want to be.

Hope that helps...
0
 

Expert Comment

by:fricitra
ID: 10665260
I had the same problem.
My SQL server 2000 database running on WIN- NT and server name in 'NTSERVER'.
SQL server name also 'NTSERVER'.

I installed .NET in my machine (Win 2000) and create connection string in ASP.NET to NTSERVER.

I receievd the same error message 'SQL Server does not exist or access denied', when I try to connect with IP address instead of server name on Data source - It's connected.

I need alternat solution other than IP address.

Pl, provide solution ...
0
 

Expert Comment

by:jnybbs
ID: 11169656
you want to use server name instead of ip address, be sure that you've added an alias for the said server on the client utility or host file and they are not in conflict with one another
0
 

Expert Comment

by:giamm
ID: 13383642
I have the same problem!!!

i tested the user credential with enterprise manager and all seems right

but by code also if i use de sa login i receive the same message:
SQL Server does not exist or access denied
this is my connection string:
Connection Timeout=20;Server=192.168.254.50;Database=DBNAME;Persist Security Info=False;Trusted_Connection=true;User ID=sa;Password=XXXX;
0
 

Expert Comment

by:jnybbs
ID: 13417782
try:

Connection Timeout=20;Server='192.168.254.50';Database=DBNAME;Persist Security Info=False;User ID='sa';Password='XXXX';
0
 

Expert Comment

by:giamm
ID: 13422720
i resolved it
yes was "Trusted_Connection=true"
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question