function db_oracle($host, $user, $passwd, $db = null) { $this->db_name = $db; $this->db_user = $user; $this->db_passwd = $passwd; $this->db_host = $host; $this->db_link_ptr = ora_logon("{$user}@{$host}", $passwd) or $this->error("", ora_error(), ora_errcode()); $this->dbhandler = @ora_select_db($db); }
function connect() { if (strtoupper($this->dbType) != "ORACLE") { return false; } if ($this->isConnect) { return true; } //echo "connect string = ".parent::getUser()."/".parent::getPassword()."@".$this->_sid."<br>"; $this->connection = ora_logon(parent::getUser() . "@" . $this->_sid, parent::getPassword()); if (!$this->connection) { $this->isConnect = false; } else { $this->isConnect = true; } return $this->isConnect; }
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if ($argHostname) { putenv("ORACLE_HOME={$argHostname}"); } //if ($argHostname) print "<p>Connect: 1st argument should be left blank for $this->databaseType</p>"; $this->_connectionID = ora_logon($argUsername, $argPassword); if ($this->_connectionID === false) { return false; } if ($this->autoCommit) { ora_commiton($this->_connectionID); } if ($this->_initdate) { $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'"); } return true; }
function getconnection() { // CONFIG $servicio = "prueba"; $dirora = "c:\\oracle\\ora81"; $usuario = "orfeo"; $contrasena = "super"; $servidor = "orfeo"; putenv("ORACLE_SID={$servicio}"); putenv("ORACLE_HOME={$dirora}"); $handle = ora_logon("{$usuario}@{$servicio}", "{$contrasena}"); if (!$handle) { print "NO HAY CONEXION ........................"; } // FIN CONFIG $q = new DB_Sql(); $q->Home = "{$dirora}"; $q->Database = "(DESCRIPTION=\r\n\t\t\t(ADDRESS_LIST=\r\n\t\t\t(ADDRESS=(PROTOCOL=TCP)\r\n\t\t\t(HOST={$servidor})(PORT=1521)\r\n\t\t\t)\r\n\t\t\t)\r\n\t\t\t(CONNECT_DATA=(SERVICE_NAME=PRUEBA))\r\n\t\t\t)"; $q->User = "******"; $q->Password = "******"; $this->cursor = $q; }
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename, $mode = 0) { if (!function_exists('ora_plogon')) { return null; } // <G. Giunta 2003/03/03/> Reset error messages before connecting $this->_errorMsg = false; $this->_errorCode = false; // G. Giunta 2003/08/13 - This looks danegrously suspicious: why should we want to set // the oracle home to the host name of remote DB? // if ($argHostname) putenv("ORACLE_HOME=$argHostname"); if ($argHostname) { // code copied from version submitted for oci8 by Jorma Tuomainen <*****@*****.**> if (empty($argDatabasename)) { $argDatabasename = $argHostname; } else { if (strpos($argHostname, ":")) { $argHostinfo = explode(":", $argHostname); $argHostname = $argHostinfo[0]; $argHostport = $argHostinfo[1]; } else { $argHostport = "1521"; } if ($this->connectSID) { $argDatabasename = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" . $argHostname . ")(PORT={$argHostport}))(CONNECT_DATA=(SID={$argDatabasename})))"; } else { $argDatabasename = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" . $argHostname . ")(PORT={$argHostport}))(CONNECT_DATA=(SERVICE_NAME={$argDatabasename})))"; } } } if ($argDatabasename) { $argUsername .= "@{$argDatabasename}"; } //if ($argHostname) print "<p>Connect: 1st argument should be left blank for $this->databaseType</p>"; if ($mode = 1) { $this->_connectionID = ora_plogon($argUsername, $argPassword); } else { $this->_connectionID = ora_logon($argUsername, $argPassword); } if ($this->_connectionID === false) { return false; } if ($this->autoCommit) { ora_commiton($this->_connectionID); } if ($this->_initdate) { $rs = $this->_query("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'"); if ($rs) { ora_close($rs); } } return true; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <?php //<meta http-equiv="Refresh" content="3;URL=http://www.algunsitio.com/nuevo.html">, $servidor = "localhost"; $bd = "bdprueba"; $usuario = "root"; $contrasena = "jhlc"; putenv("ORACLE_SID=DBPRUEBA"); putenv("ORACLE_HOME=/oracle1/product/817"); $handle = ora_logon("fldoc@bdprueba", "Fldoc"); ora_commiton($handle); $cursor = ora_open($handle); $numeroa = 0; $numero = 0; $numeros = 0; $numerot = 0; $numerop = 0; $numeroh = 0; echo "<center>DocuImage - WEB <BR> CONTROL DOCUMENTOS DE CORRESPONDENCIA</center>"; echo "<table border=1 width=100%>"; echo "<td width=55%>"; echo "<br>"; $isql = "select USUA_LOGIN,USUA_PASW from usuario where USUA_LOGIN ='******'"; $resultado = ora_parse($cursor, $isql); $resultado = ora_exec($cursor);
<?php $servicio = "bdprueba"; $dirora = "/oracle1/product/817"; $usuario = "fldoc"; $contrasena = "Fldoc"; putenv("ORACLE_SID={$servicio}"); putenv("ORACLE_HOME={$dirora}"); $handle = ora_logon("{$usuario}@{$servicio}", "{$contrasena}"); ora_commiton($handle); if ($sololect) { $auxsololect = "S"; } else { $auxsololect = "N"; } $isql = "select max(anex_numero) from anexos " . "where anex_radi_nume={$radi}"; $cursor = ora_open($handle); ora_parse($cursor, $isql) or die("No se encontró el radicado Buscado"); ora_exec($cursor); $bien = ora_fetch($cursor); $auxnumero = ora_getColumn($cursor, 0); $auxnumero += 1; $codigo = $radi . str_pad($auxnumero, 5, "0", STR_PAD_LEFT); if ($bien) { $isql = "select anex_tipo_ext from anexos_tipo " . "where anex_tipo_codi={$tipo}"; $cursor = ora_open($handle); ora_parse($cursor, $isql); ora_exec($cursor); $bien = ora_fetch($cursor); $extension = ora_getColumn($cursor, 0); $archivo = trim($radi . "_" . $auxnumero . "." . $extension);