This is a module to add support for oracle database without touching the drupal 6.4 core code.
This means that we solved some problems like blob handling in distinct clob use, bind variables... etc..
It is tested with some core modules,
and we use it with those modules enabled:
fckeditor
imce
servizi
ateneo
oranfs
simplemenu
facolta
system
block
color
comment
content
content_copy
content_permissions
dblog
fieldgroup
filter
help
ldapauth
locale
menu
node
nodereference
number
og
og_access
og_actions
og_views
optionwidgets
path
search
taxonomy
text
translation
trigger
update
upload
user
userreference
views
views_export
views_ui
To use with views its necessary the views blob handling patch: http://drupal.org/node/307049
you can use it like this (obviously you need the php oci extension installed):
cd drupal-6.4
tar xzvf oracle.tgz
this will unzip 4 files:
includes/database.oracle.inc: the oracle interface implementation
includes/install.oracle.inc: the oracle installation interface implementation (so that you can choose oracle on the install.php)
install.oracle.patch: the patch for includes/install.inc to add 'oracle' to the list of supported db
views.blob.patch: the patch to blob handling for the views module
patch -p 0 < install.oracle.patch
cp views.blob.patch sites/all/modules/views/
cd sites/all/modules/views/
patch -p 0 < views.blob.patch
That is all. Its a testing release but to us looks good, and we are using it to build a demo site.
I really would like to say thank you to Matteo Leoni from Plurimedia that tested it a lot to help me find bugs.
Please help us to find the others :).....
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | oracle.tgz | 13.27 KB | aaaristo |
| #2 | oranfs.drupal.tgz | 1.75 KB | aaaristo |
| oracle.tgz | 12.91 KB | aaaristo |
Comments
Comment #1
aaaristo commentedtitle change
Comment #2
aaaristo commentedusing http://oranfs.sourceforge.net its also possible to store 'sites/default/files' inside oracle and with the attached oranfs (implements hook_update_index via Oracle Text ctx_doc.iflter) module you can have full text search also on files.
If you have multiple nodes running drupal they can share the same fs.
Comment #3
aaaristo commentedComment #4
hswong3i commentedI think we should have some cooperation. I did some work in http://siren.sourceforge.net/, may I have some of your comment?
Comment #5
aaaristo commentedOf course! The main difference i see is that siren seems to be a "parallel" release, with a big effort to keep it in sync. (a serious project)
What we where trying to achieve with our oracle backend was to use the mainstream release of drupal,
so that we can apply patches, upgrades, etc... Probably to gain such a result we actually give out some performance,
and we need some hack in the code, but for us was a MUST to be able to use the same sources as any other backend database.
Actually we solved a lot of little problems like bind variables between '"' or BLOBs columns in distinct clauses.. and of course
the oracle reserved word problem. But the main approach was to make it works and solve the "real" problems and not to
over-engineer it trying to solve all the problems.
For performance reasons we decided not to implement CLOBs everywhere but to use varchar2(4000)
as most as we can (all varchar2 until we need a CLOB some where: we discovered that even if a lot of columns where declared as big text
a few of them where really used with big values, so.. may be we are wrong but it works!).
Actually we needed CLOBs only on those columns:
BATCH.BATCH
SESSIONS.SESSION
SEARCH_DATASET.DATA
none of which is used in a where statement or group by fortunately.
For the same reasons we are not trying to address all oracle reserved words... but only the one that is used:
uid
session
file
access
mode
comment
we was using this query:
select lower(keyword) keyword from v$reserved_words where reserved= 'Y' or res_type= 'Y' or res_attr= 'Y' or res_semi= 'Y'
to find out and replace keywords but we ended up to use fixed regexp actually, was faster and cleaner.
About BLOBs:
. the first implementation was to have blob inside tables... until a DISTINCT have been found
. the second implementation was to have a BLOB table and its numeric primary key as the blob fields in tables so db_encode_blob returns a number
that can be used by db_decode_blob to select the content. The problem at this point is that for each db_encode_blob a different BLOB is inserted. So we
needed a job to cleanup orphaned BLOBs.
. we ended up using an md5 hash. So db_encode_blob inserts the BLOB only if there is no existing BLOB with the same md5 hash. Was really faster. there is
a little probabilty to have doubles... :) but we don't loose our sleep for it actually.
Please ask whatever you need.
Comment #6
hswong3i commentedThe reason of parallel release for siren is the difficulty of integrate research progress into main stream, based on political but not technical concern. I give a summarize to most contributed issue for Oracle in http://groups.drupal.org/node/8663, part of them still need some love. Because I am not just targeting on Oracle but also DB2 and MSSQL support, those changes are the common factors of universal database abstraction but not over-engineering :S
Using CLOB may not be a suitable choice since PDO_OCI is buggy with that. As D7 force database support with PDO, the only suitable choice is implement those required field as BLOB. On the other hand, BLOB is more common among different databases, where CLOB is just available for some database engine with a lot of limitation.
For the reserved word issue, we are not able to handle uid/session/file/etc only. Take Views/CCK as example, they will generate tables on-the-fly, based on user input values. This may cause (http://drupal.org/node/371#comment-636053): 1. the conflict of reserved word, 2. didn't solve the auto upper case of constraint within Oracle engine, and 3. hit the maximum 30 characters limitation of constraint name in Oracle/DB2. Avoid the use of reserved word can only handle the conflict within core, but introduce a lot of hidden technical requirement to normal developer and end users, who are not DB expert (especially not Oracle expoert).
Target for stable release can't merge Oracle support into main stream, since CVS HEAD is keep on changing. We will never refine the stable release with additional feature add. If we hope to contribute for main stream, we need people to support and spend some time to work together with the community. This is the tradition of Drupal community, which I had discovered within this 2 years contribution.
P.S. The CVS HEAD of Siren is sync with D7 and I am now preparing it for main stream contribution, e.g. testing in Siren and generate patch for D7. I would like to invert you to join the research and give more indeed discussion for that.
Comment #7
aaaristo commentedlast release, runs with SimpleTest
Comment #8
pasquallewhy is this a critical bug for D6???
just create a new project if you care about oracle support in D6. http://drupal.org/node/7765
This will not be included in D6, as this is a new feature and such as will not be committed into stable version..
Comment #9
Babalu commentedsubscribe
Comment #10
Crell commentedFor D7, an Oracle driver should be possible via contrib with no core modifications. If not, then we need someone to be trying to write a real D7 contrib driver so that we can figure out where it breaks and if we can do something about it in core, incrementally.
So far all efforts in that direction have been sledgehammer approaches that have been rejected with good reason. That's sad, as Oracle support would be cool. I wish someone would try to write one properly.
Comment #11
pbuonaiuto commentedI've been working with the Oracle extension on an Oracle XE/drupal 6.4 installation. Seems to work reasonably well, but I have noticed one important bug related to your work around for CLOBs (using varchar2(4000) for larger text data). Entering a text string >4000 into a text field or text area (e.g., the body of a node) throws an insert error and appears to throw off version bookkeeping in Drupal. This seems to leave the node inaccessible.
To prevent users from entering >4000 characters, I wrote a hook_alter_form module to validate text areas...
Comment #12
Crell commentedThat's a known issue with Oracle not being able to handle large text. hswong3i has been pushing to therefore convert all TEXT fields in Drupal into BLOB fields, but that's been rejected as we do not want to cripple other databases just because of Oracle limitations. The recommendation, which no one has tried yet AFAIK, is to alter the mapping in the Oracle driver to map larger text fields to BLOB on Oracle specifically. (There's no requirement that the same native field type be used on every database.)
Comment #13
pbuonaiuto commentedCan you explain why you change all empty strings ('') to '^', including default values on create tables. Thanks.
Comment #14
hswong3i commented@Crell: I have try your suggested mapping once before but not success. This is not a technical (e.g. Oracle functionality, PDO driver support, Drupal driver implementation, etc) but usability problem.
For solving the Oracle maximum 4000 VARCHAR2 limitation, we have 3 solution:
If we do have some other suggestion/solution, please feel free to discuss for :D
Comment #15
dave reidFeature requests are for 7.x only. Marking as 'to be ported' since this needs to be ported to a DBTNG driver.
Comment #16
aaaristo commentedactually you can add the column you found on the install.oracle.inc and transform it to a CLOB and to correct the problem n the existing schema:
alter table t add ( newcol clob)
update t set newcol= oldcol
alter table t drop column oldcol
alter table t rename column newcol to oldcol
its ugly, but actually the better solution i think... The problems are group by and where with clobs. If your column is not used in those cases
it is fine to use clobs.
Comment #17
aaaristo commentedI change all empty strings ('') to '^' because Oracle identifies '' empty strings as nulls. There are queries in drupal that searches rows like this:
select * from variable where value= ''
This kind of query will always retun with no rows, because all operators (=,!=,>.....etc) will return false if one of the two values compared is NULL (the only operator you can use on nulls in oracle is the is the "is null" or "is not null" operator).
But this query is "valid", is asking for specific rows: not the one with NULLs values but the one with empty string values (as returned by mysql).
Thats way i replace '' with '^', or the DB_EMPTY_CHAR you selected.
hope this helps
Comment #18
chx commentedWe are not adding an Oracle driver to core. See you in contrib. If you find something during the Oracle driver development that needs DBTNG assistance please file a patch.