By gollyg on
Hi,
I was wondering if anyone has had any experience in integrating Drupal to another database using web services? Are there any modules out there for this kind of thing? Specifically I am looking at integrating a drupal site into an existing recruitment/job vacancies database - we could create a simple cron job to copy the data overnight, but I would far prefer something that made live requests of an existing database.
If anyone has had any experience in this area I would love to hear about it.
Cheers
Comments
Connect to thrid party database
Let me give you an example how I connect to external databases.
This is quite some kind of hack and a lot of static code, but it works quite well. Also tested with distant mySQL on external Servers.
STEP 1 - 3RD PARTY DATABASE CREDENTIALS
STEP 2 - CONNECT TO THIRD PARTY DATABASE
EXTENDED EXAMPLE (USING STEP 1 AND STEP2)
hope it helps
kr, Robert
http://divoky.com/drupal
Looks like companies is a
Looks like companies is a custom table with id and name as fields does it contain any more fields?
You are switching the databases back and forth. first you make database1 active and then database2 active and then database1 active. So finally the connection is only with database1 and not with database2. can throw some light here
TUTOS frontend - read third party database
Look at this article:
How to connect to multiple databases within Drupal
http://drupal.org/node/18429
That was my starting point.
Yes, you have to switch the connection frum the drupal database to your db and back again after you have read the results.
The above example was a quick and dirty hack to display results to drupal users from an external TUTOS CRM Framework. (some kind of Onlinebilling Invoice and Project presentation)
What ist missing is for sure, that you have to look to close the database connection to database 2 after you got the result, so that you dont leave open mysql zombies.
kr, Robert AT divoky.com
http://divoky.com/drupal
Webservices are better for integration than connecting to ext DB
Hello,
if you create webservice for existing recruitment/job database it can be used by other parties and makes future integration much easier. P2p integrations are difficult to maitain (and number of connections will grow to n! )
For information how to access webservice from PHP check:
http://www-128.ibm.com/developerworks/opensource/library/os-phpws/
In this article you will also find lot of usefull resources about webservices.
Check also 'amazone' module .
Regards
Jan
Thanks for all the help
Thanks to both of you for your ideas. I hadn't thought of switching db connections - I had in my mind the webservice route. But perhaps I should reconsider. Anyway, I'll give it some thought and post back if it becomes a reality.
Cheers