laravel-db2 icon indicating copy to clipboard operation
laravel-db2 copied to clipboard

Using package on windows with ODBC manager

Open NoxxieNl opened this issue 6 years ago • 0 comments

Hiya,

Great package you have here!

I am using the odbc manager from within windows to setup the connection the ODBC driver. However this packages needs the configuration for:

'System=%s',
'Database=%s',
'UserID=%s',
'Password=%s',

in ODBCConnector.php

I only need the "odbc" option within this connector.

The idea is to allow 2 extra settings to be specified in the config file:

'windows_odbc_defined' => true,
'windows_odbc_name' => 'name'

When these settings are specified the odbc connector will make the odbc connection based on what is specified.

Changes in ODBCConnector.php:

if ($config['windows_odbc_defined'] == true) {
            $dsnParts = [
                'odbc:%s'
            ];

            $dsnConfig = [
                $config['windows_odbc_name']
            ];

        } else {
            $dsnParts = [
                'odbc:DRIVER=%s',
                'System=%s',
                'Database=%s',
                'UserID=%s',
                'Password=%s',
            ];

            $dsnConfig = [
                $config['driverName'],
                $config['host'],
                $config['database'],
                $config['username'],
                $config['password'],
            ];
        }

NoxxieNl avatar Jan 22 '19 08:01 NoxxieNl