require(db2func.pinc) in your file. See
db2func.pinc or db2func.phps (prettyprint source)
Connecting and retrieving results from a database using the ODBC interface requires the following steps:
/* need to set $dsn: data source name
$user: what user to connect as
$upasswd: password for the user
in our examples we simply set the $dsn. The user is
the user the web server runs as
no password is required.
This is a DB2 thing */
$conn = odbc_connect($dsn, $user,$upasswd );
echo "conn: $conn";
if ($conn <= 0) {
echo "Error in connection<BR>";
exit;
}
else {
echo "<P>Connection successful\n";
};
$query = "SELECT * FROM DBMS.$Table";
$result = odbc_Exec($conn, $query)
odbc_result_all($result); to display the entire result as a table or use a loop with odbc_fetch_row($result) to select each row and odbc_result($result, "attribute") to fetch individual attributes in the row
odbc_Close($conn);
Search |
Computer Science |
Feedback
Site Map