/** * connect to client database * @return boolean true on success */ function connect() { // check parameters // To support oracle tnsnames.ora dbname is not required if (!$this->getdbHost() || !$this->getdbUser()) { $this->error = "empty_fields"; return false; } /* if (!$this->getdbHost() || !$this->getdbName() || !$this->getdbUser()) { $this->error = "empty_fields"; return false; } */ include_once "./Services/Database/classes/class.ilDBWrapperFactory.php"; $this->db = ilDBWrapperFactory::getWrapper($this->getdbType(), $this->ini->readVariable("db", "inactive_mysqli")); $this->db->setDBUser($this->getdbUser()); $this->db->setDBPort($this->getdbPort()); $this->db->setDBPassword($this->getdbPass()); $this->db->setDBHost($this->getdbHost()); $this->db->setDBName($this->getdbName()); $con = $this->db->connect(true); if (!$con) { $this->error = "Database connection failed."; return false; } $GLOBALS["ilDB"] = $this->db; $this->db_exists = true; return true; }