Chapter 1. Creating an SQL environment

#include <x/sql/env.H>

x::sql::env henv=x::sql::env::create();

std::map<std::string, std::string> drivers, data_sources;



It is necessary to create an x::sql::env reference to a reference-counted object before connecting to an SQL server. get_drivers() enumerates available SQL drivers. get_data_sources() enumerates available SQL data sources. A driver represents an SQL server type. A data source is a predefined connection to an SQL server, created and maintained by the ODBC connection manager.

get_drivers() and get_data_sources() populate a std::map keyed by a driver or a data source name. The value is the description of the data source.