user48408
user48408

Reputation: 3354

Problem with SQLBrowseConnect

I'm making a call to odbc32.dll (SQLBrowseConnect) to return a list of databases on a sql server.

From running a trace I can see the query being executed is

select name from master..sysdatabases where has_dbaccess(name)=1

If the credentials I pass aren't the sa user it returns just the system databases. Is there anyway I can use SQLBrowseConnect with another user (whose default database is also not guarenteed to be the master database) to return all databases on the server?

Also I want to avoid smo objects

Upvotes: 2

Views: 431

Answers (1)

ETL Man
ETL Man

Reputation: 255

In our ETL tools we do use SQLBrowseConnect to get a list of available SQL servers.

We do not use it for getting list of the databases

SQLExecDirect(FHSMT,PAnsiChar ('select name from MASTER.dbo.sysdatabases order by name'), SQL_NTS)

We use different ODBC driver for different versions of SQL server.

Upvotes: 1

Related Questions