|
Hello,
When I coded a routine to access a db2 database via PHP, as in the
article from IBM, all seems to work, BUT ... I get the following on the
page, and no connect to the database :
Warning: SQL error: [unixODBC][Driver Manager]Data source name not found,
and no default driver specified, SQL state IM002 in SQLConnect in
/var/www/html/db2lib.php on line 8
Connection to database failed.
Warning: odbc_errormsg(): supplied argument is not a valid ODBC-Link
resource in /var/www/html/db2lib.php on line 12 Fatal error: Call to
undefined function: author_form() in /var/www/html/select.php on line 47
The routine, as coded from the IBM page is :
<?php function dbconnect($verbose) {
$dbname = "spirit";
$username = "db2inst1";
$password = "db2inst1";
// odbc_connect returns 0 if the connection attempt fails;
// otherwise it returns a connection ID used by other ODBC functions
$dbconn = odbc_connect($dbname, $username, $password);
if (($verbose == TRUE) && ($dbconn == 0)) {
echo("Connection to database failed.");
$sqlerror = odbc_errormsg($dbconn);
echo($sqlerror);
}
return($dbconn);
}
?>
Can anyone help me?
Mairhtin O'Feannag
mairhtin at techsolutionsgroupllc dot com (yeah, it's a long one!) |