Solved

URGENT help : how to get the DBPROP_INIT_CATALOG ?

Posted on 2000-03-15
3
521 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 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

695 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