#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    246

    How do you use and exisitng DB with Ruby


    Hi,

    I seem to be going round in circles trying to understand how I use an existing MS SQL Database with RoR, also how do I set up my applicaiton to use two MS SQL servers in different locations (different IP addresses and DSN's)

    I have edited the database.yml following instructions on the web http://www.myclojureadventure.com/2010/10/getting-rails-3-up-on-windows.html , but that only seems to be for a single SQL server / DSN, my app needs to use more than one SQL server, so where do I put that info.. this is what I currently have
    Code:
    # SQLite version 3.x
    #   gem install sqlite3
    #
    #   Ensure the SQLite 3 gem is defined in your Gemfile
    #   gem 'sqlite3'
    development:
        adapter: sqlserver
        mode: odbc
        dsn: my_dsn
        username: my_username
        password: my_password
        host: server_ip
        database: my_dev_database
    
    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    test:
        adapter: sqlserver
        mode: odbc
        dsn: my_dsn
        username: my_username
        password: my_password
        host: server_ip
        database: my_test_database
    
    production:
        adapter: sqlserver
        mode: odbc
        dsn: my_dsn
        username: my_username
        password: my_password
        host: server_ip
        database: my_production_database
    Also the instructions then say to run : 'rake db:create' , Do I want to do this? I don't want to create a DB, I want to use an exisiting one

    Is this creating the DB in SQL or in the application?

    I'm very confused with all this and appreciate your assistance.

    Thanks,

    1DMF
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2005
    Posts
    112
    Rep Power
    10
    You need not use db:migrate as you have an existing database. db:migrate is used to add new modifications to the database in rails.

    It would have been good if you would have shared your db schema. But the following gem can help you in getting started: https://github.com/bosko/rmre

    Also, refer to following pages to understand how you can connect to multiple databases.

    http://bitblender.blogspot.in/2008/10/connecting-to-multiple-database-in-ruby.html

    http://stackoverflow.com/questions/1404620/using-rails-migration-on-different-database-than-standard-production-or-devel (See the response from Marlin Pierce).

    I hope that helps you.
    @ PresentSoft Technologies Pvt. Ltd., a software development firm in Goa - India, we develop scalable applications using on Ruby on Rails and Android.

    My blog @ AnayKamat.com
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    246
    Thanks, but I've uninstalled RoR, it's all to much command line this and command line that, I can't get to grips with it and can't do something as simple as write a couple of lines of code to get some data out of SQL.

    I'm thinking I might look at Python instead, or simply stick with perl and use a framework with that instead.

    Cheers,
    1DMF.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    ruby on rails developers


    Ruby on rails web development has made available most of the e-commerce sites to use user-friendly features and moulder approach.

IMN logo majestic logo threadwatch logo seochat tools logo