Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have followed this tutorial for getting connected to a Microsoft SQL Server. I connect with ping functionality of Glassfish Server and thus I have to give some user rights to be able to even ping the Database.

My problem is that probably my user has not rights to take external connections to the database or even more sad, not any permissions. What kind of user permissions there should be applied before I can connect to my database with my user?

(I suppose there are needed some GRANTS before accessing the database, because making that on Mysql needed quite many of them. Now the actual problem is I could not apply the same queries here 'cause the SQL scripts are incombatible)

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Check for "CONNECT" rights

SELECT SUSER_NAME(grantee_principal_id), * 
FROM sys.server_permissions WHERE type = 'COSQ'
GO
USE MYDB
GO
SELECT USER_NAME(grantee_principal_id), * 
FROM sys.database_permissions WHERE type = 'CO'

To fix as needed

USE master
GO
GRANT CONNECT SQL TO myLogin
GO
USE MYDB
GO
GRANT CONNECT TO MyUser
GO
share|improve this answer
    
+1: Thanks for fast reply! I'll accept answer after I test this solution first. –  mico Aug 5 '11 at 14:01
    
I added CONNECT on a graphical tool (I feel more comfortable with it) and I was able to connect the Database. Thanks. –  mico Aug 8 '11 at 8:25
    
To be able to connect from another machine I had to give Firewall pass to sqlservr.exe file through the firewall as well as port 1433. –  mico Aug 8 '11 at 11:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.