Solved

URGENT help : how to get the DBPROP_INIT_CATALOG ?

Posted on 2000-03-15
3
511 Views
Last Modified: 2008-02-20
I'm writing an OLEDB provider.

I need the parameters sent by the consumer: user id, password, data Source and the catalog (database).

I was able to get the first 3 (user id, password and datasource), but I can't find how to get the catalog.

I will be very thankful to whoever will help me.
0
Comment
Question by:tal47
3 Comments
 
LVL 3

Expert Comment

by:ahoor
ID: 2620566
How about db_name() ??

Or do you mean something else?

0
 

Author Comment

by:tal47
ID: 2622926
I mean something else ...

I get the user ID, password and dataSource using this:


 this->QueryInterface(IID_IGetDataSource, (void**)&spDataSource);
CComPtr<IDBProperties>  spProperties;

spDataSource->GetDataSource(IID_IDBProperties,                          (IUnknown**)&spProperties);

CDBPropIDSet      set[1];

set[0].SetGUID(DBPROPSET_DBINIT);

DBPROPSET*            pPropSet = NULL;
ULONG                  ulPropSet = 0;
CComVariant varObj;
 


hr = spProperties->GetProperties(1, set, &ulPropSet, &pPropSet);
            
for(ULONG u = 0; u < pPropSet[0].cProperties ; u++)
 ...

In the documentation i have found, it said that the property:
 DBPROP_INIT_CATALOG, is part of DBPROPSET_DBINIT.

However, what i get is only 12 properties (out of 24 written in the doecumentation), and DBPROP_INIT_CATALOG is not one of them.

How can i find this property ?
0
 

Accepted Solution

by:
MicroD earned 10 total points
ID: 2627950
Try this....

Returns the list of catalogs in the specified linked server, which is equivalent to databases in Microsoft® SQL Server
™.
Syntax

sp_catalogs [@server_name =] 'linked_svr'

Argument

[@server_name =] 'linked_svr'

Is the name of a linked server. linked_svr is sysname, with no default.

Return Code Values

None

Result Sets

Column name      Data type      Description
catalog_name      nvarchar(128)      Name of the catalog
Description      nvarchar(4000)      Description of the catalog
Permissions

Execute permissions default to the public role.

Examples

This example returns catalog information for the linked server named OLE DB ODBC Linked Server #3.

Note  For sp_catalogs to provide useful information, the OLE DB ODBC Linked Server #3 must already exist.

USE master

EXEC sp_catalogs 'OLE DB ODBC Linked Server #3'
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

770 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