I've started a project where the user can either connect to a mySQL database or an oracle database. I got the mySQL part down but oracle is being a bit difficult. Standard queries work such as SELECT * FROM author, but when I try to load a script in order to create the schema I get invalid operation errors. I've tried using 'START' and '@' in various ways but to no avail. These commands work in the command line but not in php. I've tried the following:
else if($databaseType == "Oracle")
{
$c = oci_connect($username, $password, $server);
if (!$c) {
echo "Unable to connect: " . var_dump( oci_error() );
die();
}
// Delete previous schema
$s = oci_parse($c, "@/oracle/dropall");
oci_execute($s, OCI_DEFAULT);
// Create schema
$s = oci_parse($c, "@/oracle/oracle");
oci_execute($s, OCI_DEFAULT);
// Create first trigger
$s = oci_parse($c, "@/oracle/oracle_trigger1");
oci_execute($s, OCI_DEFAULT);
// Create second trigger
$s = oci_parse($c, "@/oracle/oracle_trigger2");
oci_execute($s, OCI_DEFAULT);
// Populate the database
$s = oci_parse($c, "@/oracle/oracle_populate");
oci_execute($s, OCI_DEFAULT);
// Commit to save changes...
oci_commit($c);
// Logoff from Oracle...
oci_free_statement($s);
oci_close($c);
}