Instiki and SQL Server?

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>

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/HowtoConnectToMicrosoftSQLServer

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

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:inindex’
./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

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 :wink:

Cheers,
Assaph

Assaph M. wrote:

I believe option 3 is easiest :wink:

I agree! I will try this asap. Thanks for all your help!

Brian D. wrote:

Assaph M. wrote:

I believe option 3 is easiest :wink:

Worked like a charm! Thanks again!!