The Joomla! Extensions Directory ™


ExternalDB Plugin

ExternalDB quickly allows you to connect to an external DB without having to hard-code the connection details. Useful for creating components / modules or plugins with connections to different Databases or deployments.

Updated with multiple domains, repackaged and added support for non-standard port numbers

* Updated the documentation due to (un)popular demand! :) *

Report

2010-12-02
Reviews: 6
I have trhee diferent MySQL server with diferents versions. This plugin have save me a lot of hours!! really great!!
2010-05-27
Reviews: 2
This is just what I needed to get out of having to connect several times to an external database using "mod_php" modules. I had php modules scattered all over my pages and each one was making an individual connection to mysql - not the best way to go about things of course!

After installing this very simple but powerful extension, I soon got results out my external database with a bit of coding and trial and error, absolutely fab, worked like a dream and I recommend that anyone who wishes to get external data to use this.

The documentation is brief and I couldn't quite work out how to display the data from the example but I got around displaying results using Dreamweaver's clunky old code to retrieve the data - I must add that I did NOT use Dreamweaver to establish the database connection - that's what this plug in does. Anyway, here's my example code which may help others until someone puts the right answer on this thread - if anyone can contribute or put me right on this then please do.


// Create new ExternalDB instance, using the details that we set earlier.

$dbxo = new externaldatabase ( 'put_the_name_of_your_database_here' );

// Create a new jDatabase object, connected with the details from the above selected DSN.

// We call ExternalDB objects $dbx just as a standard practice

$dbx = $dbxo->getDB ();


$query_whatever = "SELECT * FROM my_database_table WHERE some_field='some_value'";
$whatever = mysql_query($query_whatever) or die(mysql_error());
$row_whatever = mysql_fetch_assoc($whatever);
$totalRows_whatever = mysql_num_rows($whatever);

echo $row_whatever['the_database_column_name'];

Thats it - it works very well.

Many thanks to the developer for getting me out of a big hole!!
2010-02-16
Reviews: 2
I think this extension is unique, but lamentably without any documentation or help files, will be far from people like i am, with no high skills or DB knowledge.
Owner's reply

I've updated the original (read: poor) documentation to something that should aid developers and help those trying to work out what this plugin does and does not do. Thanks for the rating!