Showing posts with label returned. Show all posts
Showing posts with label returned. Show all posts

Monday, March 19, 2012

Active Directory as Linked Server no data being returned

We're having problems establishing a Linked Server that points at
Active Directory in SQL Server 2000. We've executed
sp_addlinkedserver and have created a view of active directory users.
However, when querying the view, no data is returned. Are we maybe
not connecting correctly? We are not receiving any error messages.
Any help would be appreciated.
Here is how we created our view:
CREATE VIEW AD_USERS AS
SELECT * FROM OpenQuery(
ADSI,'<LDAP://DC=domain,DC=com>;(& (objectCategory=Person)(objectClass=user
))
;sn,
name, adspath,title;subtree')
(except domain is replaced with our domain name)
Thanx in advance for any help!!Try querying the same OU etc. from a command line tool to make sure that
the query is returning data.
The command line tool is a Windows tools called ldifde.
Example:
ldifde -d "CN=Users,DC=<domain>" -l servicePrincipalName -F
<NewoutputUsers>.txt This syntax creates a file named NewoutputUsers.txt
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||We get data returned with the command line tool when
replacing <domain> in your example with our domain name.
What do we need to change in our OpenQuery statement to
get results with SQL Server?
quote:

>--Original Message--
>Try querying the same OU etc. from a command line tool

to make sure that
quote:

>the query is returning data.
>The command line tool is a Windows tools called ldifde.
>Example:
>ldifde -d "CN=Users,DC=<domain>" -l

servicePrincipalName -F
quote:

> <NewoutputUsers>.txt This syntax creates a file

named NewoutputUsers.txt
quote:

>Thanks,
>Kevin McDonnell
>Microsoft Corporation
>This posting is provided AS IS with no warranties, and

confers no rights.
quote:

>
>.
>
|||So, I tried to create a view to use for querying Active
Directory:
CREATE VIEW AD_USERS AS
SELECT *
FROM OPENQUERY( ADSI,
'SELECT *
FROM ''LDAP://CN=users,DC=<domain>,DC=com''')
When I query the AD_USERS view using query analyzer on
a client workstation running Enterprise Manager, there
are errors produced. When I query the same view using
query analyzer on the SQL Server server, no errors are
produced. However, even though I am selecting * from the
view, the only field to come back is adsPath. When I try
to specify another field name in the query that creates
the view, I receive the following error:
Could not get the data of the row from the OLE DB
provider 'ADSDSOObject'. Could not convert the data value
due to reasons other than sign mismatch or overflow.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject'
IRowset::GetData returned 0x80040e21: Data status
returned from the provider: [COLUMN_NAME=cn
STATUS=DBSTATUS_E_CANTCONVERTVALUE]].
Is there something that needs to be changed in the query?
Help, please.
quote:

>--Original Message--
>Try querying the same OU etc. from a command line tool

to make sure that
quote:

>the query is returning data.
>The command line tool is a Windows tools called ldifde.
>Example:
>ldifde -d "CN=Users,DC=<domain>" -l

servicePrincipalName -F
quote:

> <NewoutputUsers>.txt This syntax creates a file

named NewoutputUsers.txt
quote:

>Thanks,
>Kevin McDonnell
>Microsoft Corporation
>This posting is provided AS IS with no warranties, and

confers no rights.
quote:

>
>.
>

Friday, February 24, 2012

accessing to an oracle 10 linked server

Hello,
i try to make some select queries using a linked oracle 10 server but for a
few tables, only the first row is returned...
i haved used "Microsoft OLE provider for OCBC driver" when declaring my
linked server and my odbc link is using the lastest Oracle odbc driver
(10.1.3.1).
Using another odbc driver (microsoft odbc for oracle) instead of oracle one
make it works great on query analyser but when using it on my programs (who
are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
returning me "Impossible to start other transactions for this session".
Any clue?
Thx
Not sure but you'd definitely want to try using the OLE DB
provider instead. You add extra overhead when using the OLE
DB provider for ODBC. The OLE DB providers generally provide
more functionality as well.
-Sue
On Tue, 15 Mar 2005 07:23:03 -0800, Cdric Prin-Derre
<Cdric Prin-Derre@.discussions.microsoft.com> wrote:

>Hello,
>i try to make some select queries using a linked oracle 10 server but for a
>few tables, only the first row is returned...
>i haved used "Microsoft OLE provider for OCBC driver" when declaring my
>linked server and my odbc link is using the lastest Oracle odbc driver
>(10.1.3.1).
>Using another odbc driver (microsoft odbc for oracle) instead of oracle one
>make it works great on query analyser but when using it on my programs (who
>are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
>returning me "Impossible to start other transactions for this session".
>
>Any clue?
>Thx

accessing to an oracle 10 linked server

Hello,
i try to make some select queries using a linked oracle 10 server but for a
few tables, only the first row is returned...
i haved used "Microsoft OLE provider for OCBC driver" when declaring my
linked server and my odbc link is using the lastest Oracle odbc driver
(10.1.3.1).
Using another odbc driver (microsoft odbc for oracle) instead of oracle one
make it works great on query analyser but when using it on my programs (who
are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
returning me "Impossible to start other transactions for this session".
Any clue?
ThxNot sure but you'd definitely want to try using the OLE DB
provider instead. You add extra overhead when using the OLE
DB provider for ODBC. The OLE DB providers generally provide
more functionality as well.
-Sue
On Tue, 15 Mar 2005 07:23:03 -0800, Cdric Prin-Derre
<Cdric Prin-Derre@.discussions.microsoft.com> wrote:

>Hello,
>i try to make some select queries using a linked oracle 10 server but for a
>few tables, only the first row is returned...
>i haved used "Microsoft OLE provider for OCBC driver" when declaring my
>linked server and my odbc link is using the lastest Oracle odbc driver
>(10.1.3.1).
>Using another odbc driver (microsoft odbc for oracle) instead of oracle one
>make it works great on query analyser but when using it on my programs (who
>are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
>returning me "Impossible to start other transactions for this session".
>
>Any clue?
>Thx

Monday, February 13, 2012

Accessing return from sp_monitor

When I run the stored procedure sp_monitor through VB I onlyseem to be able to access the first 3 values returned, see code below. When I run the stored procedure through the enterprise manager I can see about 13 returned values. The reader loop only seems to have one iteration, with 3 arguments, how do I access the others?

cmd.CommandText = "sp_monitor"
cmd.CommandType = CommandType.StoredProcedure
reader = cmd.ExecuteReader()

While reader.Read()
results.AppendLine(String.Format("{0}, {1}, {2}", reader.GetName(0),reader.GetName(1), reader.GetName(2)))
results.AppendLine(String.Format("{0} {1} {2} {3}<br/>",reader(0), reader(1), reader(2), ctr))
ctr = ctr + 1
End While

If you want to retrieve multiple result sets using SqlDataReader, you can use SqlDataReader.NextResult to go to next result set. For example:

cmd.CommandText = "sp_monitor"
cmd.CommandType = CommandType.StoredProcedure
reader = cmd.ExecuteReader()
While reader.HasRows
While reader.Read()
results.AppendLine(String.Format("{0}, {1}, {2}", reader.GetName(0), reader.GetName(1), reader.GetName(2)))
results.AppendLine(String.Format("{0} {1} {2} {3}<br/>", reader(0), reader(1), reader(2), ctr))
ctr = ctr + 1
End While
reader.NextResult()
End While

Or you can useSqlDataAdapter to fill the result sets into a DataSet.