?
Solved

URGENT help : how to get the DBPROP_INIT_CATALOG ?

Posted on 2000-03-15
3
Medium Priority
?
524 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 20 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

764 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