# MSSQL error - 80004005 & Rails

**URL:** <https://www.ruby-forum.com/t/mssql-error-80004005-rails/78674>\
**Category:** Rails\
**Created:** [March 8, 2006, 9:26pm UTC](https://www.ruby-forum.com/t/mssql-error-80004005-rails/78674 "2006-03-08T21:26:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markbates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@markbates](https://www.ruby-forum.com/u/markbates)\
**Post date:** [March 8, 2006, 9:26pm UTC](https://www.ruby-forum.com/t/mssql-error-80004005-rails/78674/1 "2006-03-08T21:26:48Z")

</div>

hey there folks, i have a bit of a sitch here and i would love some  
help/input on it.

i’ve inherited a horrible asp/mssql app that i’m re-writting using  
rails, but unfortunately i have to keep the asp version up and running.  
in order to do so i’ve had to write some admin functions, which i’ve  
done in rails. because the mssql schema wasn’t written very well i’ve  
had to override the table and primary keys for active record. my  
‘user.rb’ file looks like this.

class User \< ActiveRecord::Base  
set\_table\_name “users”  
set\_primary\_key “user\_id”  
end

i’m not having any problems reading from the database (sql server 2000),  
but when i try to update something i get the following error:

ActiveRecord::StatementInvalid: DBI::DatabaseError: Execute  
OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server  
Cannot create new connection because in manual or distributed  
transaction mode.  
HRESULT error code:0x80020009  
Exception occurred.: SELECT @@ROWCOUNT AS AffectedRows: UPDATE  
users SET [sb\_username] = ‘’, [hl\_perclick\_replenish] = NULL, [fname] =  
‘Mark’, [ccExpYear] = NULL, [nameoncard] = ‘’, [hl\_perclick\_method] =  
NULL, [ccType] = NULL, [hl\_perclick\_charged\_date] = NULL,  
[where\_heard\_code] = NULL, [deleted] = 0, [cookie\_expires] = NULL,  
[bill\_state] = NULL, [userTyp] = 1, [cookie\_id] = NULL, [phone] = NULL,  
[bill\_city] = ‘’, [referer] = ‘[http://www.foo.com/](http://www.foo.com/)’, [rank\_elig] = NULL,  
[hl\_perclick\_budget] = NULL, [address2] = ‘’, [browser] = ‘Mozilla/5.0  
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111  
Firefox/1.5.0.1’, [bio] = NULL, [login\_name] = ‘foo’, [lname] = ‘bar’,  
[hl\_perclick\_charged] = NULL, [hl\_active] = 0, [zip] = ‘’, [address1] =  
‘’, [modDT] = NULL, [country] = NULL, [province] = ‘’, [password] =  
‘password’, [ccNum] = ‘’, [hearabout] = ‘Foo B.’, [last\_logon] = NULL,  
[site] = ‘hk’, [creatDT] = ‘2006-03-08 11:48:09’, [ccExpMonth] = NULL,  
[email] = ‘removed\_email\_address@domain.invalid’ WHERE user\_id = 10560.0

does anybody have any ideas how i can fix this?? please please please  
help. thanks.

---

<div class="post-metadata">

**Author:** ![markbates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@markbates](https://www.ruby-forum.com/u/markbates)\
**Post date:** [June 29, 2006, 6:38am UTC](https://www.ruby-forum.com/t/mssql-error-80004005-rails/78674/2 "2006-06-29T06:38:17Z")

</div>

Got the same problem.

Does anyone have a solution for this?
