Created
April 3, 2013 14:58
-
-
Save ezimuel/5301941 to your computer and use it in GitHub Desktop.
Db2 connect using ODBC parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$database = ''; | |
$user = ''; | |
$password = ''; | |
$hostname = ''; | |
$port = 446; | |
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;". | |
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;"; | |
$conn = db2_connect($conn_string, '', ''); | |
if ($conn) { | |
echo "Connection succeeded.\n"; | |
} else { | |
echo "ERROR: connection failed.\n"; | |
var_dump(db2_conn_errormsg()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment