Connecting a C# app to a Ruby on Rails SQL database
I've built a Ruby on Rails application and used the Thin server to run it on localhost port 3000, I then used port forwarding through my router to make it available on the web. I also use a Sqlite3 for RoR which works great. The problem is that I am not sure how the database is saved...for instance, when I am developing, running a change on the schema.rb will erase all of the data saved in the database.
I am used to Apache 2 where there is an SQL file in the MySQL folder which I can easily backup, but I don't see that for RoR. Where exactly is the RoR MySQL database? Also, I'm not sure if Thin server is running in development or still in production开发者_运维问答.
On a similar note, I have a C# application that needs to connect to the RoR database, but because I don't know where it is located, I can't connect to it. I assume it would be on "localhost" but I am unsure of the database name and other credentials.
For PHP, I usually use phpmyadmin which works great for database management and it is good for doing backups, etc. I'd like to do the same for RoR, but can't figure out where the SQL database is located.
I look forward to any help I might receive on this issue
Thanks!
By default Rails uses a sqlite database. If you want to connect this to another application I suggest switching to mysql.
The sqlite databases are stored under 'db/#{databasename}.sqlite' by default. You should be able to open them up via C# using whatever the equivalent library is for SQLite there. (libsqlite? something else?)
精彩评论