Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/monara/public_html/test.athavaneng.com/themes.php on line 99

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
Obtainign Datasources
Obtaining a Datasourcename

A simple query should be a nobrainer right now. But what if your programm runs on a system where you can't be sure which datasource names are configured?

Then you should use SQLDataSources(). After allocating a environment handle you may use this to find out about the DSN and the supplied description for the datasource.

As ODBC knows systemwide and userwide datasources, you need to give a direction which datasource types you are looking for. There you may specify either of the following values:

SQL_FETCH_FIRST Sets up SQLDataSources() to lookup the first of all available datasources (either user or systemwide).
SQL_FETCH_FIRST_USER Sets up SQLDataSources() to lookup the first of the available user datasources.
SQL_FETCH_FIRST_SYSTEM Sets up SQLDataSources() to lookup the first of the available system datasources.
SQL_FETCH_NEXT Fetches the next datasource. Depending on SQL_FETCH_FIRST_USER, SQL_FETCH_FIRST_SYSTEM or SQL_FETCH_FIRST this may only be a user datasource, only a system datasource or one of either.

So let's have a look on a small function, which will return all available datasource names. You may insert this code into the program which you built before and call it somewhere after you've obtained an environment handle.

void OD_ListDSN(void)
{
 char       l_dsn[100],l_desc[100];
 short int  l_len1,l_len2,l_next;

 l_next=SQL_FETCH_FIRST;
 while( SQLDataSources(V_OD_Env,l_next,l_dsn, sizeof(l_dsn),
        &l_len1, l_desc, sizeof(l_desc), &l_len2) == SQL_SUCCESS)
     {
      printf("Server=(%s) Beschreibung=(%s)\n",l_dsn,l_desc);
      l_next=SQL_FETCH_NEXT;
     }
}