Skip to content

Loading…

DBAL-491: Oracle platform should not support dropping database #1693

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user rkolbe:

It appears that attempting to run the Doctrine ORM test suite against an Oracle database causes the following exception:

[root@raymond-kolbe-1 orm]# /usr/local/zend/bin/phpunit -c oracle.xml
PHPUnit 3.7.19 by Sebastian Bergmann.

Configuration read from /home/rkolbe/sites/trainingv2/vendor/doctrine/orm/oracle.xml

......................SSSSSS...........................E

Time: 1 second, Memory: 68.75Mb

There was 1 error:

1) Doctrine\Tests\ORM\Functional\AdvancedAssociationTest::testIssue
Doctrine\DBAL\DBALException: An exception occurred while executing 'DROP USER rkolbe CASCADE':

ORA-01940: cannot drop a user that is currently connected

/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:47
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php:189
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php:112
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:791
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:816
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:306
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/TestUtil.php:66
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php:315
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php:17

Caused by
Doctrine\DBAL\Driver\OCI8\OCI8Exception: ORA-01940: cannot drop a user that is currently connected

/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php:28
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php:189
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php:112
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:791
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:816
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:306
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/TestUtil.php:66
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php:315
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php:17

FAILURES!
Tests: 56, Assertions: 98, Errors: 1, Skipped: 6.

After investigating, I asked myself "Should Doctrine support dropping a "database"?" It should not, and here is why.

1) Oracle does not consider a "database" the same way MySQL and other vendors do. A "schema" is* the database and this *is the "user". Dropping a "database" drops the user. How would we recreate the database for testing purposes (read: DBAL drops and recreates the database)?

2) Oracle platform in DBAL does not support creating a database. Is this something we wish to support? I'm not sure how we would recreate a schema, since creating a schema is the same as creating a user. This is something we don't support on any platform. Also note, the return value of supportsCreateDropDatabase() is misleading as it says Oracle does support this feature.

Although this issue originated in Doctrine ORM, the root cause is the Oracle platform implementation in DBAL. I propose we remove support for dropping "databases" in Oracle since there is no way to create them.

@doctrinebot

Comment created by @beberlei:

That is why you have to have two users configured in the phpunit.xml, the temporary user deletes the first user and recreates him. This works perfectly fine for us. I am not sure we should remove this.

@doctrinebot

Comment created by @beberlei:

Closing as won't fix, anything else is an enhancement, depends on the arguments for removing this approach

@doctrinebot

Issue was closed with resolution "Won't Fix"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.