MsSqlServer ActiveRecord Adapter

2 views
Skip to first unread message

Sam Smoot

unread,
Oct 12, 2006, 11:38:55 PM10/12/06
to Dallas Ruby Brigade
Hey guys, I was hoping we might get a little community action going
here. I've been to a few dallas.rb meetings, but I've been slacking the
past few months. :-)

Either way, a friend and I have written a Ruby C++ Extension for
Windows to allow Rails to work with SQL Server better (ever tried
internationalizing a Rails site with the sqlserver adapter? Not gonna
happen since it doesn't do Unicode).

It's at the point where we could really use the help of the community
to put it through it's paces. It's not a gem release yet, but I've
written a step-by-step guide to getting your site working with it and
it's really very simple.

So if you're feelin' charitable, here it is:
http://substantiality.net/articles/2006/10/12/mssqlclient-step-by-step-guide

If you take a liking to it and would like to discuss further in person,
maybe I can motivate my lazy self to make it out to another meeting.
:-)

Thanks, -Sam

PS: No, you're not seeing double. We did manage to convince our
employer to ask for some help with this awhile back and their recruiter
posted a contractor link here describing this very project. The site it
was meant for was cancelled and the project canned though, so a friend
and I took up the torch to make it happen ourselves. Of course not
knowing C++ was a small hurdle to overcome. :-D

Craig Neuwirt

unread,
Oct 13, 2006, 12:15:10 PM10/13/06
to dall...@googlegroups.com
Running with WEBrick I got the following error. Any ideas?
 
=> Booting WEBrick...
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:248:in `load_missing_constant': uninitialized constant ActiveSupport::Deprecation::RAILS_DEFAULT_LOGGER (NameError)
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:329:in `const_missing'
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/deprecation.rb:16
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/deprecation.rb:23:in `call'
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/deprecation.rb:23:in `warn'
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/reloadable.rb:43:in `included'
        from /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:209:in `include'
        from /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:209
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'
         ... 13 levels...
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:364:in `require'
        from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:39
        from script/server:3:in `require'
        from script/server:3


 

Sam Smoot

unread,
Oct 13, 2006, 12:23:15 PM10/13/06
to Dallas Ruby Brigade
I haven't seen that issue. I'm guessing you're running Edge Rails?
(Since I don't recognize the Deprecation module, but did hear about
that being added on the way to 2.0)

Do you know the specific revision? Maybe I can duplicate it and work
the kinks out if I can duplicate your setup.

And thanks for the feedback! Sorry it isn't working out for you out of
the box. :-(

Craig Neuwirt

unread,
Oct 13, 2006, 12:47:36 PM10/13/06
to dall...@googlegroups.com
Yup, using it with Edge Rails, revision 5284

Sam Smoot

unread,
Oct 17, 2006, 6:27:41 PM10/17/06
to Dallas Ruby Brigade
Ok, well lazy bastard that I am, I didn't bother specifying a revision.
So I just froze rails (at revision 5318), and tested it against a fresh
application with the adapter and it seems to work fine.

That combined with the stack trace you provided makes me suspect it's
something in your application. If you want to contact me by email I'd
be more than happy to help you get to the bottom of this just to be
sure though.

Thanks for the feedback! -Sam

Craig Neuwirt

unread,
Oct 18, 2006, 5:11:04 PM10/18/06
to dall...@googlegroups.com
To be honest, I am rather new to Ruby and started a very simple App.
I executed rake rails:freeze:edge in my app directory, created the lib
directory as described by the instructions and updated my environment.rb
and database.rb configs accordingly, but I still get the same issue.
 
What could cause this in my existing app which is very simple?
 
craig

 

Craig Neuwirt

unread,
Oct 18, 2006, 6:07:28 PM10/18/06
to dall...@googlegroups.com
When I ran with gem rails I get
 
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:11: warning: already initialized constant OPTIONS
./script/../config/../config/environment.rb:8: warning: already initialized constant RAILS_GEM_VERSION
=> Booting WEBrick...
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:11: warning: already initialized constant OPTIONS
./script/../config/../config/environment.rb:8: warning: already initialized constant RAILS_GEM_VERSION
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:11: warning: already initialized constant OPTIONS
./script/../config/../config/environment.rb:8: warning: already initialized constant RAILS_GEM_VERSION
lib/mssqlclient/ms_sql_client.dll: Permission denied - lib/mssqlclient/ms_sql_client.dll (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport- 1.3.1/lib/active_support/dependencies.rb:147:in `require'
        from ./lib/mssqlclient/mssqlclient_adapter.rb:5

        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/

 
On 10/17/06, Sam Smoot <ssm...@gmail.com> wrote:

Sam Smoot

unread,
Oct 18, 2006, 7:11:33 PM10/18/06
to Dallas Ruby Brigade
The permission denied error is interesting. I did forget to mention
that .NET2 is a dependency. Sorry about that. That might be the issue?
Do you have .NET2 installed?

Lemme try WEBrick real quick with my example app... Hmm... nope, that
works.

Would you mind sharing your database/application with me? I'd really
like to get to the bottom of this for you. My email account is
"ssmoot", on gmail if you can email it. If it's too big to email
(>10MB) I can give you FTP access to my host.

Thanks, -Sam

Sam Smoot

unread,
Oct 19, 2006, 12:05:08 AM10/19/06
to Dallas Ruby Brigade
Just wanted to mention, I just checked in Revision 6, which fully
supports UTF8 to/from Unicode (UTF16LE) both ways. So I'm pretty close
to releasing a Gem I think, but you might want to double-check that you
have .NET2 installed, and give Rev6 a spin.

Sam Smoot

unread,
Oct 19, 2006, 6:41:56 PM10/19/06
to Dallas Ruby Brigade
I've just released a Gem for the adapter. There's a short overview of
how to install, use it here:

http://substantiality.net

Craig Neuwirt

unread,
Oct 22, 2006, 3:02:50 PM10/22/06
to dall...@googlegroups.com
Hello Sam,
 
  Sorry for the late reply.  I wasnt running on a .NET2 environment so I set
one up an ran against a brand new Rail app.  All I did was change the envornment.rb
and database.yaml.  However, I still received the permission denied issue.  I had
the same problem with the gem install too.  I am running against cygwins Ruby
installation if this makes a difference. 
 
thanks,
  craig

 

Sam Smoot

unread,
Oct 22, 2006, 10:27:19 PM10/22/06
to Dallas Ruby Brigade
Maybe, I've never done that. Maybe it's a .NET Code-Access-Security
issue?

Maybe it's just a misunderstanding since I didn't explain it very
clearly: This Adapter is a Windows only thing. It's not intended for
Linux machines (or Mono installations). Not that you're doing that
necessarily, but I'm a little fuzzy on cygwin to be honest. Here's the
setup I've tested with:

Windows (w/ .NET2) + Ruby One-Click installer
gem install rails mongrel -y
gem install mssqlclient
rails MyApp
modify database.yml and environment.rb
mongrel_rails start

And that's it. It just works. I've done the same thing on an XP
machine, and my iMac under Parallels.

If you're willing to help me figure out how to duplicate your cygwin
setup, I can give it a shot, but I understand if you're beginning to
think this is more trouble than it's worth. I'm committed to doing my
best to make this succeed though if you're up for it.

Thanks, -Sam

PS: Back to that .NET CAS stuff, that might make a lot of sense...
though the code isn't doing anything that should require enhanced
priviledges. Maybe there's something in your security event-log or
something?

Craig Neuwirt

unread,
Oct 23, 2006, 8:04:31 AM10/23/06
to dall...@googlegroups.com
Hi Sam,
 
  Thanks for your patience on this one.

 
On 10/22/06, Sam Smoot <ssm...@gmail.com> wrote:

Maybe, I've never done that. Maybe it's a .NET Code-Access-Security
issue?

Maybe it's just a misunderstanding since I didn't explain it very
clearly: This Adapter is a Windows only thing. It's not intended for
Linux machines (or Mono installations). Not that you're doing that
necessarily, but I'm a little fuzzy on cygwin to be honest. Here's the
setup I've tested with:
 
 
You have explained it perfect.  Cgywin is just a unix-like environment on
Windows which I am a big fan of.
 

 
Windows (w/ .NET2) + Ruby One-Click installer
gem install rails mongrel -y
gem install mssqlclient
rails MyApp
modify database.yml and environment.rb
mongrel_rails start

And that's it. It just works. I've done the same thing on an XP
machine, and my iMac under Parallels.
 
I have been running with WebBrick too. 

 
If you're willing to help me figure out how to duplicate your cygwin
setup, I can give it a shot, but I understand if you're beginning to
think this is more trouble than it's worth. I'm committed to doing my
best to make this succeed though if you're up for it.
 
I am pretty sure it must be environmental on my side so I'll spend a
little more time investigating before we need to start duplicating my
env on you machine.

 
Thanks, -Sam

PS: Back to that .NET CAS stuff, that might make a lot of sense...
though the code isn't doing anything that should require enhanced
priviledges. Maybe there's something in your security event-log or
something?
 
I'll definitely look into this one.
 
And thanks again for all your help.
craig
 

 
Reply all
Reply to author
Forward
0 new messages