Can I access another apps mysql database with my rails app?

Sorry if the answer is obvious (nube alert) but would it be possible for me to access the DB of a php app using a mysql database, from within my Rails app?

I want to install my (php) forums in forum.site.com, and my main site (using rails) will be at the root, site.com - so could I list the latest forum thread, in my Rails side of the site, by simply accessing the mysql database directly?

Guess I would just need to give it username/pw for the db, and the mysql query?

Is it going to be easy enough to do, or should I stick with a full php solution (can't drop PHP as we need a full featured forum like vB).

[i]Thanks in advance.[/i]

Sorry if the answer is obvious (nube alert) but would it be possible for me to access the DB of a php app using a mysql database, from within my Rails app?

I want to install my (php) forums in forum.site.com, and my main site (using rails) will be at the root, site.com - so could I list the latest forum thread, in my Rails side of the site, by simply accessing the mysql database directly?

Guess I would just need to give it username/pw for the db, and the mysql query?

Is it going to be easy enough to do, or should I stick with a full php solution (can't drop PHP as we need a full featured forum like vB).

That's one way and would work fine. If the tables in the other database are at least somewhat AR friendly you can also setup the connection in database.yml (ie. with a name of say "phpforums") and then create a model and use establish_connection to point it to the phpforums database.

If you're careful about how you use it, it should work fine.

Philip Hallstrom wrote:

mysql database directly?

Guess I would just need to give it username/pw for the db, and the
mysql query?

Is it going to be easy enough to do, or should I stick with a full php solution (can't drop PHP as we need a full featured forum like vB).

That's one way and would work fine. If the tables in the other database are at least somewhat AR friendly you can also setup the connection in database.yml (ie. with a name of say "phpforums") and then create a model and use establish_connection to point it to the phpforums database.

If you're careful about how you use it, it should work fine.

Thanks Philip :slight_smile:

Would you know if it is easy enough to share sessions with a forum app such as vbulletin?

Unlikely to be easy. But if the cookies are available and you're willing to parse the information you could do whatever you want.

-philip

Philip Hallstrom wrote: