How to check if a database exists with ODBC

Hi fellow programmers

I searched the internet for several days and cannot find a common method to solve this problem with ODBC and SQL only.

Is there a way to see if a database exists only using ODBC . It must be standard SQL, because the user can select the DSN of his choice (which means his own SQL Server).

This means that I cannot check the main table on the server, because they are called different on different SQL servers.

Thank.

+3
source share
1 answer

I don’t know if it’s too late or “tolerable” enough for you.

MS SQL, SELECT name FROM master.dbo.sysdatabases WHERE name = @name.

ODBC SQLBrowseConnect ( ), . . , http://www.codeproject.com/KB/database/sqlsrvenumerator.aspx.

ODBC, , (, SQL Browser) /. , , - , /! , , ODBC-!

+1

Source: https://habr.com/ru/post/1758945/


All Articles