Forum: Ruby on Rails Instiki and SQL Server??

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cb21818896b28255ccebd05e257ac944?d=identicon&s=25 Brian Donahue (madscene)
on 2006-03-02 22:08
Hello.  I reeeeally want to get Instiki running at my day job, but they
are Microsoft-heads.  While I can probably sell them on trying Rails,
they are definitely going to want the database to sit in our SQL Server
instance with our other databases.  I can't get instiki to create the
tables in sql server though (I've added ADO.rb, and gotten a
connection).  When I run the create_db script I get the output below.
Has anyone tried this?


C:\software\instiki-ar>ruby script/create_db
C:/software/instiki-ar/script/../config/environment.rb:16: warning:
already init
ialized constant RAILS_ROOT
C:/software/instiki-ar/script/../config/environment.rb:23: warning:
already init
ialized constant RAILS_ENV
C:/software/instiki-ar/script/../config/environment.rb:26: warning:
already init
ialized constant ADDITIONAL_LOAD_PATHS
C:/software/instiki-ar/script/../config/environment.rb:73: warning:
already init
ialized constant RAILS_DEFAULT_LOGGER
C:/software/instiki-ar/script/../config/environment.rb:90: warning:
already init
ialized constant Controllers
Creating tables for production...
failed: #<RuntimeError: Unknown db type sqlserver>
C:/software/instiki-ar/script/../config/environment.rb:16: warning:
already init
ialized constant RAILS_ROOT
C:/software/instiki-ar/script/../config/environment.rb:23: warning:
already init
ialized constant RAILS_ENV
C:/software/instiki-ar/script/../config/environment.rb:26: warning:
already init
ialized constant ADDITIONAL_LOAD_PATHS
C:/software/instiki-ar/script/../config/environment.rb:73: warning:
already init
ialized constant RAILS_DEFAULT_LOGGER
C:/software/instiki-ar/script/../config/environment.rb:90: warning:
already init
ialized constant Controllers
Creating tables for test...
failed: #<RuntimeError: Unknown db type sqlserver>
C:/software/instiki-ar/script/../config/environment.rb:16: warning:
already init
ialized constant RAILS_ROOT
C:/software/instiki-ar/script/../config/environment.rb:23: warning:
already init
ialized constant RAILS_ENV
C:/software/instiki-ar/script/../config/environment.rb:26: warning:
already init
ialized constant ADDITIONAL_LOAD_PATHS
C:/software/instiki-ar/script/../config/environment.rb:73: warning:
already init
ialized constant RAILS_DEFAULT_LOGGER
C:/software/instiki-ar/script/../config/environment.rb:90: warning:
already init
ialized constant Controllers
Creating tables for development...
failed: #<RuntimeError: Unknown db type sqlserver>
175e47c3d060e2635df0da9df0148580?d=identicon&s=25 Assaph Mehr (Guest)
on 2006-03-03 02:06
(Received via mailing list)
Hi Brian,

Have never tried this, but...

> Creating tables for development...
> failed: #<RuntimeError: Unknown db type sqlserver>

The above error means Rails couldn't connect to the DB. I assume you
already read:
http://wiki.rubyonrails.com/rails/pages/HowtoConne...

What's left is to make sure that the ADO.rb file is loaded correctly -
probably in the config/environment.rb file BEFORE the Initializer.run
call.

HTH,
Assaph
Cb21818896b28255ccebd05e257ac944?d=identicon&s=25 Brian Donahue (madscene)
on 2006-03-03 02:50
Thanks Assaph,

The interesting thing is that when I run instiki and hit it with a
browser, it seems like it is connecting to the db, just not finding the
tables because I can't get the create_db to run:

Execute
    OLE error code:80040E37 in Microsoft OLE DB Provider for SQL Server
      Invalid object name 'webs'.
    HRESULT error code:0x80020009
      Exception occurred.: SELECT COUNT(*) FROM webs

/app/models/wiki.rb:82:in `setup?'
/app/controllers/wiki_controller.rb:17:in `index'
./script/server:49
instiki:6:in `load'
instiki:6


But, I just added:
ActiveRecord::Base.connection.instance_variable_get("@connection")["AutoCommit"]
= false

to the bottom of my environment.rb per the How-To page, but no change.
Is there another change I should make in the environment.rb that you are
referring to?

Thanks,

Brian
175e47c3d060e2635df0da9df0148580?d=identicon&s=25 Assaph Mehr (Guest)
on 2006-03-03 03:49
(Received via mailing list)
> The interesting thing is that when I run instiki and hit it with a
> browser, it seems like it is connecting to the db, just not finding the
> tables because I can't get the create_db to run:

Oops my bad - just remembered setup in the ARbeta. You have three
options:

1. Muck about with lib/db_structure.rb to add handling of MSSQL specific
types
2. Translate the PostgreSQL schema
3. Use the latest SVN sources. There all you need to do is define the
connection
    in database.yml and run 'rake migrate'.

I believe option 3 is easiest ;-)

Cheers,
Assaph
Cb21818896b28255ccebd05e257ac944?d=identicon&s=25 Brian Donahue (madscene)
on 2006-03-03 03:55
Assaph Mehr wrote:
> I believe option 3 is easiest ;-)

I agree!  I will try this asap.  Thanks for all your help!
Cb21818896b28255ccebd05e257ac944?d=identicon&s=25 Brian Donahue (madscene)
on 2006-03-03 04:19
Brian Donahue wrote:
> Assaph Mehr wrote:
>> I believe option 3 is easiest ;-)

Worked like a charm!  Thanks again!!
This topic is locked and can not be replied to.