rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
972 stars 559 forks source link

S1090 (0) [Microsoft][ODBC Driver Manager] Invalid string or buffer length #32

Closed carlesso closed 13 years ago

carlesso commented 14 years ago

Using the adapter on Windows XP with Microsoft SQL 2005 Express, with this database.yml

development: adapter: sqlserver host: SCADA\SQLEXPRESS username: guest password: guest dsn: Server=SCADA\SQLEXPRESS;Database=rails;Uid=guest;Pwd=guest

Running rake db:migrate returns me:

rake db:migrate --trace S1090 (0) [Microsoft][ODBC Driver Manager] Invalid string or buffer length D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:775:in initialize' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:775:inconnect' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:775:in connect' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:188:ininitialize' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:26:in new' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:26:insqlserver_connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in send' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:innew_connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in checkout_new_connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:incheckout' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in loop' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:incheckout' D:/Ruby/lib/ruby/1.8/monitor.rb:242:in synchronize' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:incheckout' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:inretrieve_connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in retrieve_connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:inconnection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:435:in initialize' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:innew' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in up' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:inmigrate' D:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116 D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' D:/Ruby/lib/ruby/1.8/monitor.rb:242:insynchronize' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 D:/Ruby/bin/rake:19:inload' D:/Ruby/bin/rake:19 (in D:/rails/test) * Invoke db:migrate (first_time) * Invoke environment (first_time) * Execute environment * Execute db:migrate

Any hint?

metaskills commented 14 years ago

Perhaps this is related to named instances on that box?

carlesso commented 14 years ago

What do you mean (forgive me, I'm not Windows/MsSQL expert at all...)

metaskills commented 14 years ago

Ha... I personally hate windows and really know little about the OS and working on it. Which is odd, cause to make this adapter so great with ActiveRecord, I have learned MUCH about SQL Server which can technically be done without touching Windows (mine runs hidden in VMWare in the background).

So yes, I'm totally ignorant on things Windows and still know quite a bit about SQL Server. I often tell my local ruby group and friends, I have no love for Microsoft, especially their OS, but SQL Server is not a bad DB as long as your not paying for it :)

That's how I square that. Meanwhile and for the hell of it, I'm trying to install IronRuby on my VMWare instance and I'll see what happens.

carlesso commented 14 years ago

Do you think is usefull to use ironruby instead of "classic" ruby istallation? And does my database.yml makes sense for you?

metaskills commented 14 years ago

In my opinion, it would be best to use Classic ruby on a POSIX system, not Windows and do what most people do, use UnixODBC to connect. If you absolutly have to be on Windows and could care less about the .Net crazy interop with IronRuby, then I say learn the hard parts of setting up classic on Windows and use it. Much like MacRuby, I would never us it for Ruby things, I always install a classic ruby on my Mac.

Re, your database.yml file. Looks good, but I'm only learning and I have not gotten to the part where I can comment on that yet. I will in the next few days tho.

metaskills commented 14 years ago

Just as an FYI, the 2.3.5 adapter support IronRuby with the ADONET connection mode. Tho, IronRuby is not fully baked, we are passing almost all the ActiveRecord tests under it now. Also a few things I noticed about your database.yml stuff. It seems you are mixing things. ODBC connection host your using "SCADA\SQLEXPRESS" is something that the IronRuby ADONET mode would understand, but not ODBC, because that string is very windows specific. IE, a domain box server instance.

metaskills commented 13 years ago

No one has hinted at supporting IronRuby in months. With the latest TinyTDS being cross compiled for windows installation and included in the upcoming RailsInstaller, I doubt there will be. If someone does want to support patches, I may consider looking into it again.