开发者

odbc32 and SQLBrowseConnect Help

开发者 https://www.devze.com 2023-01-14 19:52 出处:网络
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 execut开发者_如何学Goed is

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 execut开发者_如何学Goed 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


The query does work without sysadmin credentials.

You need to ensure that you / the credentials you are using are at least in the public database role on each of the databases that you need to connect to.

As you would guess, select name from master..sysdatabases returns all database names irrespective of your access to the DB.

0

精彩评论

暂无评论...
验证码 换一张
取 消