jruby/activerecord-jdbc-adapter — pull request #484 by seandmccarthy (2013-10-22 09:00:02+00:00)
Title: Fall back to rollback_savepoint for MS SQL Server driver

For nested transactions, ActiveRecord makes use of savepoints. When committing these transactions, ActiveRecord will call release_savepoint.

See https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb#L199

It seems that both the jTDS and Microsoft's own JDBC driver report that they support save points, however the latest Microsoft SQL Server driver (http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx) does not implement release_savepoint:

```
jruby-1.7.5 :003 > ActiveRecord::Base.connection.jdbc_connection.release_savepoint('foo')
Java::ComMicrosoftSqlserverJdbc::SQLServerException: This operation is not supported.
```

[This article](http://technet.microsoft.com/en-us/library/ms378414.aspx]) seems to show how Microsoft expect savepoints to be used with their driver. They use rollback with the savepoint name instead of invoking the JDBC releaseSavepoint method.

This pull request adds release_savepoint to the MSSQL adapter, overriding the version in the JdbcAdapter base class. It checks to see if the MSSQL adapter is using the Microsoft driver and if so calls rollback_savepoint instead.