Solved

SQL Server does not exist or access denied?

Posted on 2003-11-06
12
54,237 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now