views:

16

answers:

2

i set up a login (reviewer) under security for SQL SERVER

and under the specific database i set up a User (qcvalues_reviewer) that references this login

i have tried all these different ways to login into the database from vba:

 'cn.Open "Provider=SQLOLEDB;Data Source=hermes;Initial Catalog=test;User ID=qcvalues_reviewer; Password=92127; Trusted_Connection=yes"

 'cn.Open "Provider=SQLOLEDB;Server=hermes;Database=test;User Id=qcvalues_reviewer;Password=92127;"

 'cn.Open "Provider=SQLOLEDB;Data Source=hermes;Initial Catalog=test;User Id=qcvalues_reviewer;Password=92127;"

 'cn.Open "Provider=SQLOLEDB;Data Source=10.20.10.18,1433;Network Library=DBMSSOCN;Initial Catalog=test;User ID=qcvalues_reviewer;Password=92127;"

each time i get the error message:

login failed for user 

can someone please help me connect!

+1  A: 
Chris Diver
using sql server manamgen studio, how do i enable remote connections?
I__
Management studio is a tool you use to connect to SQL server, I mean the `edition` of SQL Server you are using, you can find this out with `SELECT @@VERSION`. Here is a how to if you are using that edition http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/
Chris Diver
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: ) (Hypervisor)
I__
As @GSerg points out you should log in with the LOGIN and not the USER, I read that wrong. - im sorry i dont understand can you write that for me
I__
That's standard edition - it will have remote connections enabled by default - your problem will be the `User Id` see @GSerg's post.
Chris Diver
thank you guys, i have tried the new string that chris provided and it still says bad login
I__
should the initial catalog be the database which i want to see?
I__
What is the exact error message, or is that it?
Chris Diver
login failed for user reviewer
I__
Did you set the `reviewer` `LOGIN` in windows (as a windows user) or did you set the user/password in Management Studio (as a SQL user)?
Chris Diver
i set the pass in managemen studio
I__
In the SQL error log see if it has a message about the failed login and it should give you a `state` code
Chris Diver
2010-08-19 11:28:33.25 Logon Login failed for user 'reviewer'. Reason: Password did not match that for the login provided. [CLIENT: 10.0.0.204]2010-08-19 11:29:04.84 Logon Error: 18456, Severity: 14, State: 8.2010-08-19 11:29:04.84 Logon Login failed for user 'reviewer'. Reason: Password did not match that for the login provided. [CLIENT: 10.0.0.204]2010-08-19 11:31:27.80 Logon Error: 18456, Severity: 14, State: 8.2010-08-19 11:31:27.80 Logon Login failed for user 'reviewer'. Reason: Password did not match that for the login provided. [CLIENT: 10.0.0.204]
I__
There is your answer - the password is incorrect. Reset the password on the login - or change it in the connection string if there is a typo.
Chris Diver
i had the wrong password :) thank you so so so so so so much
I__
+1  A: 

You should be using the login (reviewer), not the user name (qcvalues_reviewer).

Also try using the second and the third parameters of Connection.Open for User and Login, respectively.

GSerg
im sorry i dont understand what you mean?
I__
You're trying to have User ID and password in the connection string, and I'm saying, try the parameters of the Open method for that. In either case, you should be using the login name, not the user name.
GSerg
can you show me what that string would look like please
I__
thank you guys, i have tried the new string that chris provided and it still says bad login
I__
cn.Open "Provider=SQLOLEDB;Data Source=hermes;Initial Catalog=test", "reviewer", "92127"
GSerg
invlaid authroization sepcification
I__
Have you enabled mixed mode authorization on the server, or is it only willing to accept trusted connections?
GSerg
how do i enable mixed mode?
I__
GSerg
yes i checked and both modes are available
I__
i had the wrong password :) thank you so so so so so so much
I__