Question about db

Hello world,

I’m new in this forum.

Is it possible to sqlite and mysql coexists in same RoR app? I want to
extend functionalities to an app making queries toa mysql server and I’m
not sure if I can do it.

Thanks a lot,

P

On Oct 26, 2011, at 6:45 AM, pololo pololo wrote:

Hello world,

I’m new in this forum.

Is it possible to sqlite and mysql coexists in same RoR app?

Individual models can be mapped to entirely different databases (running
under different engines). More commonly, different applications are
mapped to different databases, and Rails as of 2.something supports
mounting one application inside another, so that could give you the kind
of isolation you’re talking about here.

I want to
extend functionalities to an app making queries toa mysql server and I’m
not sure if I can do it.

Are you saying you have a problem with MySQL on your server, or what?

Walter

Hi Walter,

Thanks a lot for your answer,
Walter D. wrote in post #1028584:

On Oct 26, 2011, at 6:45 AM, pololo pololo wrote:

Hello world,

I’m new in this forum.

Is it possible to sqlite and mysql coexists in same RoR app?

Individual models can be mapped to entirely different databases (running
under different engines). More commonly, different applications are
mapped to different databases, and Rails as of 2.something supports
mounting one application inside another, so that could give you the kind
of isolation you’re talking about here.

I want to
extend functionalities to an app making queries toa mysql server and I’m
not sure if I can do it.

Are you saying you have a problem with MySQL on your server, or what?

Walter

I have an application for CRM using RoR, but now, i’d like to connect to
OrangeHRM (an opensource HR Management over LAMP),to send sql queries
against this mysql server.

My problem is not related about onnecting mysql; I mean, at
database.yml, can coexists a production for mysql and sqlite or sould I
try other approach?

Thanks a lot,

P

On Oct 26, 2011, at 9:15 AM, pololo pololo wrote:

Is it possible to sqlite and mysql coexists in same RoR app?

try other approach?
I haven’t needed to do it myself yet (actually working on something that
will need this) but I have seen many tutorials on the Web related to
connecting a single Rails application to multiple databases. It is just
as simple as you say, make a production_1 and production_2 database
connection, and use them through the base classes to set up the
appropriate targets for your queries.

But what I suspect may be even easier here is for you to use something
like Sinatra to create a very simple API endpoint wrapping around the
legacy database, and then send requests through that API from your Rails
application. It doesn’t sound to me (you did mention SQL queries, after
all) as if you actually need that other database to become an
ActiveRecord model store.

Walter

Walter D. wrote in post #1028614:

On Oct 26, 2011, at 9:15 AM, pololo pololo wrote:

Is it possible to sqlite and mysql coexists in same RoR app?

try other approach?
I haven’t needed to do it myself yet (actually working on something that
will need this) but I have seen many tutorials on the Web related to
connecting a single Rails application to multiple databases. It is just
as simple as you say, make a production_1 and production_2 database
connection, and use them through the base classes to set up the
appropriate targets for your queries.

But what I suspect may be even easier here is for you to use something
like Sinatra to create a very simple API endpoint wrapping around the
legacy database, and then send requests through that API from your Rails
application. It doesn’t sound to me (you did mention SQL queries, after
all) as if you actually need that other database to become an
ActiveRecord model store.

Walter

This solved my question:

Thanks a lot for your time Walter

P