简体   繁体   中英

Get metadata with ODBC provider

I am using ODBC driver to connect to SQL Server.

I want to fetch all the databases from the server but I can't get them with connection.GetSchema() . And based on that link , there is no Catalogs or Databases keyword in the schema collection list for ODBC driver.

I'm wondering if there is another way to get all the databases ?

As the documentation states (emphasis below mine) --

You can query a .NET Framework managed provider to determine the list of supported schema collections by calling the GetSchema method with no arguments, or with the schema collection name "MetaDataCollections" . This will return a DataTable with a list of the supported schema collections, the number of restrictions that they each support, and the number of identifier parts that they use.

In other words, since connection.GetSchema() isn't working (though it should); try connection.GetSchema("MetaDataCollections") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM