These are chat archives for rails-sqlserver/activerecord-sqlserver-adapter

Oct 2015
Shane Mook
Oct 27 2015 16:13
Hey @metaskills want to say thanks for the work you've put into the SQL Server adapter and TinyTDS. I was also hoping you could push me in the right direction with a problem. We have an app that started on rails 3.0 that we upgraded to 4.2 over the last few months. We're running against a 10 year old legacy database so we hit a lot of issues with character encoding with the change to UTF-8. It seems that the connection is left in a incorrect state when SQL fails to convert that character (seems to be double byte characters in general).
We end up seeing these types of errors on the connection: ActiveRecord::StatementInvalid: The request failed to run because the batch is aborted, this can be caused by abort signal sent from client, or another request is running in the same session, which makes the session busy.
Or worse it seems to leave a transaction open which eventually causes locks
I'm tempted to patch the adapter to rescue when calling out to TinyTDS and attempt to rollback with "IF @@trancount > 0 ROLLBACK" and if that fails close the connection then raise the original error but I'm not confident I understand what effect that could have on the layers above in ActiveRecord.
Ken Collins
Oct 27 2015 17:58
Hey @smook1980
@smook1980 What version of TinyTDS are you using?
And what version of FreeTDS is it compiled against?
Ken Collins
Oct 27 2015 21:02
@smook1980 PING
Shane Mook
Oct 27 2015 21:27
Hi! Sorry I've been away from my laptop.
Shane Mook
Oct 27 2015 21:54

[14] pry(#<TinyTds::Client>):2> tds_version
=> 9
[15] pry(#<TinyTds::Client>):2> tds_version_info
=> "DBTDS_7_1/DBTDS_8_0 - Microsoft SQL Server 2000"

Compile-time settings (established with the "configure" script)
Version: freetds v0.91.112
freetds.conf directory: /c3po/vendor/bundle/ruby/2.1.0/gems/tiny_tds-0.7.0/ports/x86_64-unknown-linux-gnu/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.1
iODBC: no
unixodbc: no
SSPI "trusted" logins: no
Kerberos: no