Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define ("USUARIO","own_tester"); //USUARIO DE LA BASE DE DATOS
- define ("PASSWORD","123"); // CONTRASEÑA DE LA BASE DE DATOS
- define ("HOST_INSTANCIA","localhost/orcl"); //HOST E INSTANCIA DEL SERVIDOR LOCALHOST/INSTANCIA
- define ("CHARACTER_SET","AL32UTF8");
- class Conexion{
- private $conexion;
- public function __construct(){ //Constructor
- $this->conexion = oci_connect(USUARIO, PASSWORD, HOST_INSTANCIA,CHARACTER_SET);
- if(!$this->conexion){
- echo "ERROR!!! AL CONECTAR AL SERVIDOR DE BASE DE DATOS";
- }
- $this->alter_sesion_date();
- }
- public function __destruct(){ //Destructor
- oci_close($this->conexion);
- }
- public function query($sql){
- return oci_parse($this->conexion,$sql);
- }
- public function ejecutar($stm){
- return oci_execute($stm);
- }
- public function alter_sesion_date(){
- $sesion = $this->query("alter session set nls_date_format='DD/MM/YYYY HH24:MI:SS'");
- $this->ejecutar($sesion);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment