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
Solved

URGENT help : how to get the DBPROP_INIT_CATALOG ?

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Stored Proc - Performance Enhancement 15 52
Nested Case statement 4 36
Download ms sql express. 2 23
Location of Dynamics AX Service accounts in SQL 3 15
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

789 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