Been digging through stackoverflow for a few days now. Need to connect to a DB2 database with PHP. The following code doesn't return the error message or any helpful information, and instead just breaks Javascript later in the page.
include(TEMPLATEPATH.'/inc/library/adodb_lite/adodb.inc.php');
$DBName = 'DBNAME';
$Host = 'IPADDRESS';
$User = 'USER';
$Password = 'PASS';
$db = ADONewConnection('db2');
$dsn = "driver={IBM db2 odbc DRIVER};Database=$DBName;hostname=$Host;protocol=TCPIP;uid=$User;pwd=$Password";
if ($db->Connect($dsn)) {
echo "<div style='color:green;font-size:21px;'>Connection Successful.</div>";
} else {
echo "<div style='color:#cc0000;font-size:21px;'>Connection Failed db->Connect(dsn)</div>";
echo 'SQLSTATE: '.$db->ErrorNo()."<br>";
echo 'Message: '.$db->ErrorMsg()."<br>";
}
As followed by http://adodb.sourceforge.net/