Exemplo n.º 1
0
 function connect()
 {
     if (!$this->Connected) {
         $this->Query_ID = 0;
         if ($this->Debug) {
             printf("<br>Connecting to {$this->DBDatabase}...<br>\n");
         }
         $old_error_reporting = error_reporting();
         error_reporting($old_error_reporting & ~E_WARNING);
         if ($this->Persistent) {
             $this->Link_ID = OCIplogon("{$this->DBUser}", "{$this->DBPassword}", "{$this->DBDatabase}", $this->Encoding);
         } else {
             $this->Link_ID = OCIlogon("{$this->DBUser}", "{$this->DBPassword}", "{$this->DBDatabase}", $this->Encoding);
         }
         error_reporting($old_error_reporting);
         if (!$this->Link_ID) {
             $this->Error = OCIError();
             $this->Halt($this->Error);
             #$this->Halt("Cannot connect to Database: " . $this->Error["message"]. " ". $this->Error);
             return 0;
         }
         if ($this->Debug) {
             printf("<br>Obtained the Link_ID: {$this->Link_ID}<br>\n");
         }
         $this->Connected = true;
     }
     return $this->Connected;
 }
Exemplo n.º 2
0
<?php

// $db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA=(SID=dblocal)))" ;
// $conn = OCIlogon("GRATIFIKASI","1qaz2wsx",$db) ;
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522)))(CONNECT_DATA=(SID=orcl)))";
$conn = OCIlogon("localuser", "qwerty", $db);
date_default_timezone_set('Asia/Jakarta');
$tanggal = date('d-m-Y');
$jam = date("H:i:s");
Exemplo n.º 3
0
 function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
 {
     if ($argHostname) {
         // added by Jorma Tuomainen <*****@*****.**>
         if (strpos($argHostname, ":")) {
             $argHostinfo = explode(":", $argHostname);
             $argHostname = $argHostinfo[0];
             $argHostport = $argHostinfo[1];
         } else {
             $argHostport = "1521";
         }
         $argDatabasename = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" . $argHostname . ")(PORT={$argHostport}))(CONNECT_DATA=(SERVICE_NAME={$argDatabasename})))";
     }
     //if ($argHostname) print "<p>Connect: 1st argument should be left blank for $this->databaseType</p>";
     $this->_connectionID = OCIlogon($argUsername, $argPassword, $argDatabasename);
     if ($this->_connectionID === false) {
         return false;
     }
     if ($this->_initdate) {
         $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'");
     }
     return true;
 }