This is the code that I have so far. I've checked the credentials a million times, so I know they're correct. I'm not sure what's going wrong. Could someone please help me out? Thanks in advance!
<?php
$database = "BLUDB";
$user = "xxx";
$password = "yyyy";
$hostname = "dashdb-entry-yp-dal09-07.services.dal.bluemix.net:8443";
$port = 50000;
$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.";
db2_close($conn);
}
else {
echo "Connection failed.";
}
?>
The hostname that you are using is not the database server, but for the webconsole (see port 8443). You get the error because your string for the hostname already includes the port number AND the entire hostname is incorrect.
To fix the error get the correct connection information from either the
Connectionmenu in the dashDB dashboard or theCredentialstab in your Bluemix service overview.