orware
unread,Jun 26, 2009, 8:25:31 PM6/26/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! CMS Development
I think I had brought this up in another topic sometime last year, but
the topic has come up again in my work and this time I'm thinking of
putting together what would be required.
This is somewhat related to Mitch's topic (in regards to being able to
share some type of information between components) but it regards
sharing non-Joomla database connections between numerous extensions.
Here's the scenario:
I've created a number of extensions now that all use the Oracle driver
I built for Joomla. I use it to pull needed data out from an Oracle
database to present it via a Joomla-based frontend. If needed, I also
create database tables within my Joomla installation and store those
via the normal MySQL driver (so, I'm still installing Joomla on a
MySQL database, I just have the need to periodically pull data from
this other data source).
Before now I've been able to have the applications separate from each
other (that is, installed in separate Joomla installations), but this
week I began working on a new site for the college that makes use of
several extensions, all of which require a connection at some point to
this Oracle database (an authentication plugin, two components, and
more is on the way).
What I'm finding is that I need to store the required information to
create the database connection within each extension. Since I'm not
creating a suite of extensions I'm not thinking about tightly coupling
things by putting the connection info in just one of the extensions
and always checking it, though the thought has occurred to me.
The problem for me would be that if something were to change I would
need to go into every extension and update the connection info.
Instead my thought would be to have a "Database Manager" component
which would allow Adding/Editing/Removing connections to additional
databases aside from the one currently being used by Joomla.
The component would be really simple and the table required would
mimic that required to create the array required by
JDatabase::getInstance():
#__database
id
name (this would be a descriptive name for the connection like
"Student Database")
driver
host
user
password (since we can't use SHA-1 hashing, maybe the MySQL AES
Encryption/Decryption might be used, or not)
database
port
...(possibly some additional fields)
Then the JDatabase::getInstance() method would be modified to take a
string as input (the string being a valid value from the "name" field
in #__database).
If given a string, then JDatabase::getInstance() will go to the
#__database table and pull out the associated connection info for that
name and will then create the instance using that info for the
connection.
In addition to the component and small change to JDatabase, there
would also be a need to have some new parameter/html types for pulling
out and displaying a list of additional database connections currently
available on the site (as well as the ability to filter by the driver
in case we just want the list to show the additional MySQL databases
available).
This would make things much more manageable on my end, as I could then
input my Oracle database connection info once into the Database
Manager component and then use these new database parameter types
within my extensions to configure which Oracle database connection I
want them to use.
And with this other big project coming up this would also be handy
since it is required to be able to switch between the various database
instances we have (for example we have a "PROD" instance that serves
as our production database, but we also have clones of it made
periodically named "TEST", "FINANCE", etc. each of which would require
a different database connection string...it would be much more elegant
to be able to add a database parameter to my config, choose the 3
connections I want to use and save my changes, rather than let's say,
including 3 sets of similar parameters for me to enter in the
information directly...database_1, port_1, user_1, etc.)
I hope others feel that this might be a useful addition, and I feel it
would help make Joomla easier to use as "glue" between disparate
systems (I might be remembering wrong, but I seem to remember Louis
mentioning Joomla, the framework, PHP or all three as being a great
"glue" for connecting various systems and that being a big part of the
fun of working with it).
-Omar