Solved

URGENT help : how to get the DBPROP_INIT_CATALOG ?

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now