mardi 11 mai 2021

odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed, SQL state IM004 in SQLConnect

I am trying to connect to db2 in windows Please help me fighting on these

php -f .\db2conn.php
PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed, SQL state IM004 in SQLConnect in C:\Users\krish\OneDrive\Desktop\db2connect\db2conn.php on line 31

Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed, SQL state IM004 in SQLConnect in C:\Users\krish\OneDrive\Desktop\db2connect\db2conn.php on line 31 Connection failed.

Below my php file


<?php

$database = "SAMPLE";        # Get these database details from
$hostname = "localhost";  # the web console
$user     = "db2admin";   #
$password = "admin";   #
$port     = 3006;          #
$ssl_port = 50000;          #

# Build the connection string
#
$driver  = "DRIVER={IBM DB2 ODBC DRIVER};";
$dsn     = "DATABASE=$database; " .
           "HOSTNAME=$hostname;" .
           "PORT=$port; " .
           "PROTOCOL=TCPIP; " .
           "UID=$user;" .
           "PWD=$password;";
$ssl_dsn = "DATABASE=$database; " .
           "HOSTNAME=$hostname;" .
           "PORT=$ssl_port; " .
           "PROTOCOL=TCPIP; " .
           "UID=$user;" .
           "PWD=$password;" .
           "SECURITY=SSL;";
$conn_string = $driver . $dsn;     # Non-SSL
//$conn_string = $driver . $ssl_dsn; # SSL

# Connect
#
$conn = odbc_connect( $conn_string, "", "" );
'''
if( $conn )
{
    echo "Connection succeeded.";

    # Disconnect
    #
    odbc_close( $conn );
}
else
{
    echo "Connection failed.";
}
?>```



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3eA5MpG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire