Bitnami Rubystack Remote SQLite DB

Is it possible to set up the database.yml file to connect to a sqlite database via http://?

Also I have apache running off port 84 and my ROR app running off port 3000. I can only get PHP to execute using the apache port.

The issue is that I need to access the ROR db using the PHP file.

How would I go about doing this so that the PHP script can "see" the ROR db file located in its default directory within my ROR app?

Xenio wrote:

Also I have apache running off port 84 and my ROR app running off port 3000. I can only get PHP to execute using the apache port.

The issue is that I need to access the ROR db using the PHP file.

How would I go about doing this so that the PHP script can "see" the ROR db file located in its default directory within my ROR app?

Presumably by giving the PHP application the appropriate SQLite connection information. But you shouldn't do that if this is a production solution: SQLite is not suitable for production use due to its lack of concurrency support. Use a real multiuser DB such as PostgreSQL.

Best,

This situation is that I have an iphone app in development that uses the db. I just need to make the admin interface to edit the needed data. I'm starting to think Ruby was the worst choice for somethign non-standard like this.

But I'm pretty far in and I finished everything except the part where the iphone app dev can upload a php file to test his app script against the db.

Thanks for your response Marnen. sqlite is just a file so the connection info is the tricky part for me. The ROR app is running in a c:\users directory, while the php script is in the main apache htdoc directory which is like c:\program files \rubystack\apache2\blah blah blah

How would I write that file as far as the path to the sqlite db?

Xenio wrote:

This situation is that I have an iphone app in development that uses the db. I just need to make the admin interface to edit the needed data. I'm starting to think Ruby was the worst choice for somethign non-standard like this.

Maybe; maybe not. It's not clear from your description.

But I'm pretty far in and I finished everything except the part where the iphone app dev can upload a php file to test his app script against the db.

Thanks for your response Marnen. sqlite is just a file so the connection info is the tricky part for me. The ROR app is running in a c:\users directory, while the php script is in the main apache htdoc directory which is like c:\program files \rubystack\apache2\blah blah blah

How would I write that file as far as the path to the sqlite db?

I have no idea. Probably by supplying the path to the SQLite dbfile. This has nothing to do with Rails, and would be better directed to a SQLite or PHP forum.

Best,

Cool thanks for the direction.

I wasn't sure if this still fell under ROR or not. I figured since I was usiing the Bitnami Rubystack that isntalls everything at once I was maybe hoping someone else who uses that deployment package might have a hint.

But I will look into the PHP, SQLite forums and see what I come up with.

But... as far as my first question which would save me from trying the previous method above would be to see if there is a way to reference a sqlite db file via http or ip address in the database.yml file within the Ruby Rails app folder.

I haven’t been following the discussion too much, but SQLite is a filebased local database engine, it can’t be accessed remotely unless you have some kind of a thirdparty server application that runs on top of SQLite. That’s why RoR doesn’t support a host in the database.yml config for SQLite databases: you can’t do it with SQLite, period.

If you need network access, you could put it in a shared folder and access it that way, but I would be scared sh**less if more than one client will access the db at the same time.

Best regards

Peter De Berdt

Well that's that. Thanks for the clarification. So now thats out the picture, what about this?

Is there a way to have php execute within a Ruby App. Can I put a php file in the public directory that can access the DB in its default directory?

Please quote when replying. Otherwise it's impossible to follow the discussion.

Xenio wrote:

Well that's that. Thanks for the clarification. So now thats out the picture, what about this?

Is there a way to have php execute within a Ruby App.

Not really.

Can I put a php file in the public directory that can access the DB in its default directory?

Why would you want to? Just tell the PHP application where the DB is and how to connect to it. This should not be difficult, but exact instructions are off topic for the Rails mailing list.

Best,

Why would you need to do that? Just make sure the permissions on the SQLite database file allow both your PHP app and your Rails app to access it. Then connect to the SQLite from your PHP app using the path. But again, this is no different than putting it on a network share: you access the same file with two processes, which is a bad idea. Compare it to throwing one bone to two dogs, they’ll fight over it and eventually damage it.

It’s been said once, and it will be said again: if you want multiuser access to your database, use a database that supports it, i.e. MySQL or PostgreSQL.

Best regards

Peter De Berdt

I found a solution for my issues. I just pointed the default directory of apache to the same dir the db was in. just on another port. quick fix.