# Poco::Data::ODBC

# class Connector

Library: Data/ODBC
Package: ODBC
Header: Poco/Data/ODBC/Connector.h

## Description

Connector instantiates SqLite SessionImpl objects.

## Inheritance

Direct Base Classes: Poco::Data::Connector

All Base Classes: Poco::Data::Connector

## Member Summary

Member Functions: bindStringToLongVarChar, createSession, name, registerConnector, stringBoundToLongVarChar, unregisterConnector

Inherited Functions: createSession, name

## Constructors

### Connector

Connector();

Creates the Connector.

## Destructor

### ~Connector

~Connector() override;

Destroys the Connector.

## Member Functions

### bindStringToLongVarChar

static void bindStringToLongVarChar(
bool flag = true
);

If set to true (default), std::string is bound to SQL_LONGVARCHAR.

This can cause issues with SQL Server, resulting in an error ("The data types varchar and text are incompatible in the equal to operator") when comparing against a VARCHAR.

Set this to false to bind std::string to SQL_VARCHAR.

NOTE: This is a global setting, affecting all sessions. This setting should not be changed after the first Session has been created.

### createSession

Poco::AutoPtr < Poco::Data::SessionImpl > createSession(
const std::string & connectionString,
std::size_t timeout = Poco::Data::SessionImpl::LOGIN_TIMEOUT_DEFAULT
) override;

Creates a ODBC SessionImpl object and initializes it with the given connectionString.

### name

const std::string & name() const override;

Returns the name associated with this connector.

See also: Poco::Data::Connector::name()

### registerConnector

static void registerConnector();

Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory

### stringBoundToLongVarChar

static bool stringBoundToLongVarChar();

Returns true if std::string is bound to SQL_LONGVARCHAR, otherwise false (bound to SQL_VARCHAR).

### unregisterConnector

static void unregisterConnector();

Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory

## Variables

### KEY

static const std::string KEY;

Keyword for creating ODBC sessions.