public function initialize(DataSourceHandler $handler, DataSourceMetaData $datasource)
 {
     if (!isset($datasource->database)) {
         throw new IllegalStateException(t('Entry name from tnsnames.ora is not provided'));
     }
     $connection = OCIImplHelper::oci_connect($datasource->username, $datasource->password, $datasource->database);
     $sql = array('ALTER SESSION SET NLS_SORT=ASCII7_AI', 'ALTER SESSION SET NLS_COMP=LINGUISTIC');
     $statementExecutor = new OCIExecuteStatementImpl();
     $statementExecutor->execute($handler, $connection, $sql);
     return $connection;
 }
    public function initialize(DataSourceHandler $handler, DataSourceMetaData $datasource) {
        if (!isset($datasource->database)) {
            throw new IllegalStateException(t('Entry name from tnsnames.ora is not provided'));
        }

        $connection = OCIImplHelper::oci_connect($datasource->username, $datasource->password, $datasource->database);

        $oracleDateTimeFormat = $handler->getExtension('formatDateValue')->prepareFormat(DateTimeDataTypeHandler::$FORMAT_DEFAULT, FALSE);
        $oracleDateTimeTZFormat = $handler->getExtension('formatDateValue')->prepareFormat(DateTimeDataTypeHandler::$FORMAT_DEFAULT, TRUE);

        $sql = array(
            'ALTER SESSION SET NLS_SORT=ASCII7_AI',
            'ALTER SESSION SET NLS_COMP=LINGUISTIC',
            "ALTER SESSION SET NLS_DATE_FORMAT='$oracleDateTimeFormat'",
            "ALTER SESSION SET NLS_TIMESTAMP_FORMAT='$oracleDateTimeFormat'",
            "ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='$oracleDateTimeTZFormat'");

        $statementExecutor = new OCIExecuteStatementImpl();
        $statementExecutor->execute($handler, $connection, $sql);

        return $connection;
    }