Showing posts with label sql2k. Show all posts
Showing posts with label sql2k. Show all posts

Thursday, March 29, 2012

how query Active Directory from sql2k server?

I've seen this linked server syntax many times in the group. but it
didn't work for me, maybe someone can explain it better for me?
sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDSOObject', 'adsdatasource'
i know that:
* " ADSI" is the server argument, which will be the name of this
linked server.
* "Active Directory Services" is the srvproduct argument, which is
the name of the OLE DB data source that you are adding as a linked
server.
* "ADSDSOObject" is the provider_name argument and indicates you
are using the OLE DB Provider.
* "adsdatasource" is the data_source argument, which is the name of
the data source as interpreted by the OLE DB Provider.
my questions are:
what "ADSDSOObject" and "adsdatasource" should be in my case? do i
need an dsn for odbc, does the AD server needs to have an instance of
sql server and so on.
for example, if i have a sql2k server call 'sql2ksvr', and an active
directory server called 'adsvr'.
exactly what step by step instructions would be to set it up in a way
that i can query the groups and users information in AD?
thank you guys!!Hi Steve
You linked server should be as is, the open query should specify your
server. See the example at:
http://msdn.microsoft.com/library/d...eneous_data.asp
And the query such as:
SELECT * FROM Openquery(ADSI, 'SELECT givenName FROM
''LDAP://192.168.0.10/OU=Aurora,DC=sales,DC=company,DC=org'' WHERE
objectCategory
= ''person'' AND objectClass = ''user''')
You will need to change the IP address (or server name) and thje OU/DC parts
.
This may also help:
http://msdn.microsoft.com/library/d...r />
_94fn.asp
John
"=== Steve L ===" wrote:

> I've seen this linked server syntax many times in the group. but it
> didn't work for me, maybe someone can explain it better for me?
> sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
> 'ADSDSOObject', 'adsdatasource'
> i know that:
> * " ADSI" is the server argument, which will be the name of this
> linked server.
> * "Active Directory Services" is the srvproduct argument, which is
> the name of the OLE DB data source that you are adding as a linked
> server.
> * "ADSDSOObject" is the provider_name argument and indicates you
> are using the OLE DB Provider.
> * "adsdatasource" is the data_source argument, which is the name of
> the data source as interpreted by the OLE DB Provider.
>
> my questions are:
> what "ADSDSOObject" and "adsdatasource" should be in my case? do i
> need an dsn for odbc, does the AD server needs to have an instance of
> sql server and so on.
> for example, if i have a sql2k server call 'sql2ksvr', and an active
> directory server called 'adsvr'.
> exactly what step by step instructions would be to set it up in a way
> that i can query the groups and users information in AD?
> thank you guys!!
>|||i ran the following scripts on my sql2k server
script#1
sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject',
'adsdatasource'
go
script#2
SELECT * FROM
OpenQuery( ADSI, 'SELECT ADsPath FROM "LDAP://DC=MyCompany's domain
name,DC=COM" WHERE
objectClass= "user" ')
and i've got the following error
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB
provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject'
ICommandPrepare::Prepare returned 0x80040e14].
is there a way to test if the linked server is working? or is there a
sample folder in AD i can query against with to see where the problems
are?
thank you.|||i finally figured how that works. i have to log into server directly
and run the query. and now i have a new question.
how to modify the following query so i can have the users and groups
they belong to? I just want to find out all the groups and users
relationship.
can some one tell me what fields available? I try to use * but it
didnt' work.
SELECT a.name, a.adspath, b.name, b.adspath
FROM OpenQuery(ADSI,
'SELECT name, ADsPath
FROM ''LDAP://shiva/ DC=MyCompany's Domain,DC=com''
WHERE objectCategory = ''person''') a,
OpenQuery(ADSI,
'SELECT name, ADsPath
FROM ''LDAP://shiva/ DC=MyCompany's Domain,DC=com''
WHERE objectCategory = ''group''') b|||Steve how did you finally get it to work because I am still getting that
error message running straight from the SQL Server.
"=== Steve L ===" wrote:

> i finally figured how that works. i have to log into server directly
> and run the query. and now i have a new question.
> how to modify the following query so i can have the users and groups
> they belong to? I just want to find out all the groups and users
> relationship.
> can some one tell me what fields available? I try to use * but it
> didnt' work.
> SELECT a.name, a.adspath, b.name, b.adspath
> FROM OpenQuery(ADSI,
> 'SELECT name, ADsPath
> FROM ''LDAP://shiva/ DC=MyCompany's Domain,DC=com''
> WHERE objectCategory = ''person''') a,
> OpenQuery(ADSI,
> 'SELECT name, ADsPath
> FROM ''LDAP://shiva/ DC=MyCompany's Domain,DC=com''
> WHERE objectCategory = ''group''') b
>

Wednesday, March 28, 2012

How not to display all databases under sql2k using sql management studio?

When you use sql 2005 management studio to connect to a sql 2005 server, you can deny view on any database and one user will not be able to see any database that he/she does not own.

However, what about if this person uses sql 2005 management studio to connect to a sql 2000 server. Since sql 2005 management studio does not call the store procedure sp_MSdbuseraccess, it will display all the database in the server.

It does not seem like I can use "deny view on any database to username" on a sql 2000 server.

Does anyone have any idea what I need to do in order to not show all the database when I use sql 2005 management studio to connect to a sql 2000 server box?

Thank you.EM will show the database as existing, but you can still deny access to the database and prevent people from opening it up or viewing the objects and data inside it.

Only admins should be using Enterprise Manager anyway...|||What I want to do is to deny any login id (who owns certain database) to not be able to see other database at all.

Just like sql 2005, you can run "deny view any database to userid"

However, doesn't seem like sql 2000 has this command.|||The databases are like houses. You can prevent people from going inside, but you can't prevent people from seeing them.