Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-210

PDOOracle and OCI8 Drivers have a wrong implementation for their getDatabase function

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Can't Fix
    • Affects Version/s: 2.1.5, 2.2-BETA1, 2.2-BETA2, 2.2-RC1/RC2, 2.2.0-RC3
    • Fix Version/s: None
    • Component/s: Drivers
    • Security Level: All
    • Labels:
      None
    • Environment:
      Any

      Description

      The method getDatabase in both the PDOOracle & OCI8 drivers return the "user" param not the "dbname" as expected and defined in DBAL/Driver interface. Compare their implementation with that of the MySql driver for a proper implementation. This must have been an oversight.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        But the user parameter is the "database" in oracle, the dbname is the name of the service instance.

        Show
        Benjamin Eberlei added a comment - But the user parameter is the "database" in oracle, the dbname is the name of the service instance.
        Hide
        Marc Campeau added a comment -

        Well to be precise, the user is the name of the schema that contains all the objects created by that user.

        So you connect to a SID (dbname) as a User and anything you create resides in a schema named after your user name. You could also be granted access to another schema. I'm not sure how you intended this function to be used, but I needed to get from a Connection the SID it connected to and I assumed that getDatabse would yield that since there are already getUser, getPassword, getHost and getPort functions. Maybe this function doesn't really apply in the context of Oracle and the current implementation is better.

        As to why I needed the SID:
        I've been using the DBAL Migrations project and wanted to use the the postUp() function to import some database dumps I've taken with Oracle EXP and for that I need to create a connection descriptor, since this is a process that I want to automate and replicate I thought I could get the info through the connection. Maybe I'll just refactor and use the DBAL configuration values instead of asking the connection.

        Show
        Marc Campeau added a comment - Well to be precise, the user is the name of the schema that contains all the objects created by that user. So you connect to a SID (dbname) as a User and anything you create resides in a schema named after your user name. You could also be granted access to another schema. I'm not sure how you intended this function to be used, but I needed to get from a Connection the SID it connected to and I assumed that getDatabse would yield that since there are already getUser, getPassword, getHost and getPort functions. Maybe this function doesn't really apply in the context of Oracle and the current implementation is better. As to why I needed the SID: I've been using the DBAL Migrations project and wanted to use the the postUp() function to import some database dumps I've taken with Oracle EXP and for that I need to create a connection descriptor, since this is a process that I want to automate and replicate I thought I could get the info through the connection. Maybe I'll just refactor and use the DBAL configuration values instead of asking the connection.
        Hide
        Benjamin Eberlei added a comment -

        I say this is an oversight of us, we are not really Oracle experts and this matched our expectations compared to other vendors much better.

        You can use $connection->getParams() to get to the database name.

        Show
        Benjamin Eberlei added a comment - I say this is an oversight of us, we are not really Oracle experts and this matched our expectations compared to other vendors much better. You can use $connection->getParams() to get to the database name.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Marc Campeau
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: