How can the code for handling connections in the Oracle Server version of the class be improved for better performance and error handling in PHP?

The code for handling connections in the Oracle Server version of the class can be improved for better performance and error handling by implementing connection pooling and using try-catch blocks for handling exceptions. This will help in reusing existing connections, reducing the overhead of creating new connections each time, and gracefully handling any errors that may occur during the connection process.

<?php
class OracleServer {
    private $connection;
    
    public function connect() {
        try {
            $this->connection = oci_pconnect('username', 'password', 'localhost/XE');
        } catch (Exception $e) {
            die("Connection failed: " . $e->getMessage());
        }
    }
    
    public function query($sql) {
        $statement = oci_parse($this->connection, $sql);
        oci_execute($statement);
        return oci_fetch_all($statement, $result);
    }
    
    public function disconnect() {
        oci_close($this->connection);
    }
}
?>