Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting using 'driverName' => '{IBM DB2 ODBC DRIVER}' #31

Open
alexanderfiabane opened this issue Jul 10, 2017 · 5 comments
Open

Comments

@alexanderfiabane
Copy link

Hello,

I'm using windows 8.1 64 bits with php_pdo_odbc.dll for php. Already installed IBM ODBC CLI driver 64bits.
When I try to use standard parameters connection like:

'ibmi' => [
            'driver'               => 'db2_ibmi_odbc',           
            'driverName'           => '{IBM DB2 ODBC DRIVER}',            
             // General settings
            'host'                 => env('DB_HOST', 'localhost'),
            'protocol'             => env('DB_PROTOCOL', ''),
            'username'             => env('DB_USERNAME', ''),
            'password'             => env('DB_PASSWORD', ''),
            //Server settings
            'database'             => env('DB_DATABASE', ''),
            'prefix'               => '',
            'schema'               => env('DB_SCHEME', ''),
            'port'                 => env('DB_PORT', '60000'),

I get this error: SQL30081N A communication error has been detected. Communication protocol
being used: "TCP/IP". Communication API being used: "SOCKETS". Location
where the error was detected: "". Communication function detecting the error: "connect".

Analising the connection string I saw that DB2Connector class put all parameters, but when it pass to Connector class(laravel) the port and protocol parameters are not been passed.

Then I do this trick:

'ibmi' => [
            'driver'               => 'db2_ibmi_odbc',           
            'driverName'           => '{IBM DB2 ODBC DRIVER};PROTOCOL=TCPIP;HOSTNAME=MyHost;PORT=60000',            
             // General settings
            'host'                 => env('DB_HOST', 'localhost'),
            'protocol'             => env('DB_PROTOCOL', ''),
            'username'             => env('DB_USERNAME', ''),
            'password'             => env('DB_PASSWORD', ''),
            //Server settings
            'database'             => env('DB_DATABASE', ''),
            'prefix'               => '',
            'schema'               => env('DB_SCHEME', ''),
            'port'                 => env('DB_PORT', '60000'),

Doing this I'v got a connection, but when I tried to call Model::all() method I'v got this error: FatalErrorException
syntax error, unexpected '?'

Unfortunatly, there is no php_pdo_ibm.dll for windows 64bits. Plus, i Access IBM driver was discontinued after windows 7.1.

Any clue will be welcome ^^.

By the way, congratulations and thank you for the effort to develop this plugin. I know linux is better for this purpose, so I'm builduing a virtual machine to test my code.

Best Regards,
Alexander

@cooperl22
Copy link
Owner

Hi @taperinha

There's still a Windows package. See there:
https://www-03.ibm.com/systems/power/software/i/access/solutions.html

It is written...
These optional packages are only available for download on the Entitled Systems Support (ESS) website under 5761-SS1 or 5770-SS1.
So you need an account to download it.

We have developers here who are under Windows 10 without any issue. Actually you don't have to set the port number. I don't set it in the DSN. You forced it by setting the "driverName".
Anyway the PORT isn't documented anywhere by IBM about ODBC connection on IBMi.

Please get back to me if you still have issues after you downloaded the right package...
It's a 475Mb file named IBM_i_Access_Client_Solutions_-_Win_AP_LCD8_2011_08.zip as of today.

Best regards,

@alexanderfiabane
Copy link
Author

Hi @cooperl22

I checked with support team and we are without IBM support. Only in August the IBM support will be active again.

I didn't understand why I'v got this error:

FatalErrorException
syntax error, unexpected '?'

in this class/line:

DB2Grammar.php / line 189
return $this->dateFormat ?? parent::getDateFormat();

when I connect with that trick using IBM ODBC CLI Driver:

'ibmi' => [
            'driver'               => 'db2_ibmi_odbc',           
            'driverName'           => '{IBM DB2 ODBC DRIVER};PROTOCOL=TCPIP;HOSTNAME=MyHost;PORT=60000',            
             // General settings
            'host'                 => env('DB_HOST', 'localhost'),
            'protocol'             => env('DB_PROTOCOL', ''),
            'username'             => env('DB_USERNAME', ''),
            'password'             => env('DB_PASSWORD', ''),
            //Server settings
            'database'             => env('DB_DATABASE', ''),
            'prefix'               => '',
            'schema'               => env('DB_SCHEME', ''),
            'port'                 => env('DB_PORT', '60000'),

But ok, I'm gonna wait our IBM support be active again, then download that file (IBM_i_Access_Client_Solutions_-_Win_AP_LCD8_2011_08.zip)

I really appreciate your atention. Thank you very much.
And sorry for any inconvenience.

Best regards,

@VieiraGabrielAlexandre
Copy link

Where i have {IBM DB2 ODBC DRIVER} ?

@alexanderfiabane
Copy link
Author

Hello @VieiraGabrielAlexandre ,

Please, check the cooperl22's comment about Windows package, right above my last comment. If you are using Linux, I suggest you read this link: http://www-01.ibm.com/support/docview.wss?uid=swg21692171.

Kind regards,

@mramireza272
Copy link

Hi everyone,

I'm trying to connect with DB2 instance but T got this error when I check database connection "SQLSTATE[08004] SQLDriverConnect: 10061 [IBM][Controlador ODBC de System i Access]Error de enlace de comunicaciones. comm rc=10061 - CWBCO1049 - La aplicaci�n del servidor de IBM i no se ha iniciado o la conexi�n ha sido bloqueada por un cortafuegos".

This is my configuration database file

`'ibmi' => [
'driver' => 'db2_ibmi_odbc',
// or 'db2_ibmi_ibm' / 'db2_zos_odbc' / 'db2_expressc_odbc
'driverName' => '{IBM i Access ODBC Driver}',
// or '{iSeries Access ODBC Driver}' / '{IBM i Access ODBC Driver 64-bit}'
'host' => env('DB_HOST', '192.168.1.30'),
'username' => env('DB_USERNAME', 'db2inst1'),
'password' => env('DB_PASSWORD', 'admin'),
'database' => 'WRKRDBDIRE',
'prefix' => '',
'schema' => 'default schema',
'port' => 50000,
'date_format' => 'Y-m-d H:i:s',
// or 'Y-m-d H:i:s.u' / 'Y-m-d-H.i.s.u'...
'odbc_keywords' => [
'SIGNON' => 3,
'SSL' => 0,
'CommitMode' => 2,
'ConnectionType' => 0,
'DefaultLibraries' => '',
'Naming' => 0,
'UNICODESQL' => 0,
'DateFormat' => 5,
'DateSeperator' => 0,
'Decimal' => 0,
'TimeFormat' => 0,
'TimeSeparator' => 0,
'TimestampFormat' => 0,
'ConvertDateTimeToChar' => 0,
'BLOCKFETCH' => 1,
'BlockSizeKB' => 32,
'AllowDataCompression' => 1,
'CONCURRENCY' => 0,
'LAZYCLOSE' => 0,
'MaxFieldLength' => 15360,
'PREFETCH' => 0,
'QUERYTIMEOUT' => 1,
'DefaultPkgLibrary' => 'QGPL',
'DefaultPackage' => 'A /DEFAULT(IBM),2,0,1,0',
'ExtendedDynamic' => 0,
'QAQQINILibrary' => '',
'SQDIAGCODE' => '',
'LANGUAGEID' => 'ENU',
'SORTTABLE' => '',
'SortSequence' => 0,
'SORTWEIGHT' => 0,
'AllowUnsupportedChar' => 0,
'CCSID' => 819,
'GRAPHIC' => 0,
'ForceTranslation' => 0,
'ALLOWPROCCALLS' => 0,
'DB2SQLSTATES' => 0,
'DEBUG' => 0,
'TRUEAUTOCOMMIT' => 0,
'CATALOGOPTIONS' => 3,
'LibraryView' => 0,
'ODBCRemarks' => 0,
'SEARCHPATTERN' => 1,
'TranslationDLL' => '',
'TranslationOption' => 0,
'MAXTRACESIZE' => 0,
'MultipleTraceFiles' => 1,
'TRACE' => 0,
'TRACEFILENAME' => '',
'ExtendedColInfo' => 0,
],
'options' => [
PDO::ATTR_CASE => PDO::CASE_LOWER,
PDO::ATTR_PERSISTENT => false,

        ]
    ],`

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants