- 论坛徽章:
- 0
|
本帖最后由 68930089 于 2011-01-21 16:23 编辑
請問一下高手下面的內容為原先連結oracle ,現在想改為連線成db2 odbc
不知要做那些修改,php odbc function 跟 oracle php function
對應有語法有地方可以查的到嗎?
$handle = ora_logon("sa@sas","sa") or die;
$cursor = ora_open($handle);
ora_commitoff($handle);
print "<FORM ACTION=./aix_cpu.php?VAR_SERVER=$VAR_SERVER&VAR_PERIOD METHOD=POST >\n";
print "<p align=center>PERIOD : ";
print "<SELECT NAME=VAR_PERIOD onChange=submit()>\n";
//print "<OPTION VALUE=>\n";
if ( $VAR_PERIOD == "DAILY" )
{
print "<OPTION VALUE=DAILY SELECTED>DAILY\n";
print "<OPTION VALUE=MONTHLY>MONTHLY\n";
}
else
{
print "<OPTION VALUE=DAILY>DAILY\n";
print "<OPTION VALUE=MONTHLY SELECTED>MONTHLY\n";
}
print "</SELECT>\n";
//print "<INPUT TYPE=SUBMIT VALUE=Sumit>\n";
print "</FORM>\n";
switch ( $VAR_PERIOD )
{
case "DAILY":
$query = "SELECT GENTMST,
AVG_CPU_US,
AVG_CPU_SY,
AVG_CPU_ID,
AVG_CPU_WA
FROM SA.AIX_CPU_DAILY
WHERE HOST='$VAR_SERVER'
AND GENTMST >= TO_CHAR(SYSDATE - 30,'YYYY-MM-DD')";
ora_parse($cursor, $query) or die;
ora_exec($cursor);
print "<table border=1 align=center>\n";
print "<tr>\n";
print "<td colspan=5> <p align=center>Daily CPU Statistics</p></td>";
print "</tr>\n";
print "<tr>\n";
print "<td> <p align=center>Date</td>\n";
print "<td> <p align=center>User Time</td>\n";
print "<td> <p align=center>System Time</td>\n";
print "<td> <p align=center>Idle Time</td>\n";
print "<td> <p align=center>Wait Time</td>\n";
print "</tr>\n";
while(ora_fetch($cursor))
{
print "<tr>\n";
$VAR_GENTMST = trim(ora_getcolumn($cursor, 0));
$VAR_CPU_US = trim(ora_getcolumn($cursor, 1));
$VAR_CPU_SY= trim(ora_getcolumn($cursor, 2));
$VAR_CPU_ID= trim(ora_getcolumn($cursor, 3));
$VAR_CPU_WA = trim(ora_getcolumn($cursor, 4));
$VAR_FONT = "<font color=#000000>";
print " <td width=AUTO >\n";
print " <p align=center>$VAR_FONT $VAR_GENTMST\n";
print " </td>\n";
print " <td width=AUTO>\n";
print " <p align=right>$VAR_FONT $VAR_CPU_US\n";
print " </td>\n";
print " <td width=AUTO>\n";
print " <p align=right>$VAR_FONT $VAR_CPU_SY\n";
print " </td>\n";
print " <td width=AUTO>\n";
print " <p align=center>$VAR_FONT $VAR_CPU_ID\n";
print " </td>\n";
print " <td width=AUTO>\n";
print " <p align=center>$VAR_FONT $VAR_CPU_WA\n";
print " </td>\n";
print "</tr>\n";
}
print "</table>\n";
break; |
|