The Oracle driver assumes it's only being used for the Drupal installation itself. I'm trying to use it to import data from an external Oracle database into a Drupal environment based on MySQL. My call
$conn = Database::getConnection('default', 'testimport');
reports:
oracle[10274]: error: SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view does not exist
(/Users/mikeryan/tmp/PDO_OCI-1.0/PDO_OCI-1.0/oci_statement.c:142) select id, identifier from long_identifiers where substr(identifier,1,3) not in ('IDX','TRG','PK_','UK_') order by length(identifier) desc
I see that the long_identifiers table is supposed to be created by the Oracle driver itself, but this is done only at Drupal install time, if Drupal is being installed into the Oracle db. OK, so what if I try to do it myself?
$task = new DatabaseTasks_oracle();
$task->initializeDatabase();
No good:
Fatal error: Call to undefined method DatabaseConnection_mysql::oracleQuery() in /Users/mikeryan/html/migrate72/includes/database/oracle/install.inc on line 23
initializeDatabase() doesn't know anything about my testimport connection, it just tries to use the default connection (which is MySQL in this case). I could add a $connection parameter to initializeDatabase, defaulting to 'default' - but that only puts off the problem. The tables the Oracle driver creates to manage Oracle quirks like the contraint name length belong not in the Oracle database, but in the Drupal default database. The difference may be subtle to those using the driver to install Drupal in Oracle, but it's critical in this context... Right now I'm doing proof-of-concept testing and have write access to the test database, so I could get away with creating the tables there, but most likely I will only have read access to the real source database.
Also note that the admin UI performance, long identifiers, and blob tabs produce the undefined method error.
Oh, but the weird thing is - selecting from the connection actually seems to work (at least for simple cases). But I'm not sure how much I can trust it - how dependent is the driver on long_identifiers and its sister tables? In particular, will blob selection fail?
Comments
Comment #2
aaaristo commentedi think we are going to support external databases in the future but not yet... I think we should detect at the connect time if we are using an external database or a drupal database. In the external database case we should skip any kind of translation stuff that actually we do for the drupal backend case.
Comment #3
odavy commentedAny news on this? Would be very useful to use here with this amendment.
Comment #4
aaaristo commentedfixed in 1.10