activerecord-jdbc-adapter
activerecord-jdbc-adapter copied to clipboard
MSSQL - JDBCError: A result set was generated for update
I am only getting the error when I do any kind of insert statement. The error is coming from the exec_insert method. I've got the transaction from the SQL Profiler tool, which you can see below and I think I am right in saying that the problem has something todo with the select statement after the insert. As you can see this returns a single row column with a column name of GENERATED_KEYS. However, I really can't see why this could be the problem as the exec_insert method isn't really doing anything special.
ERROR:: ActiveRecord::JDBCError: com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update
INSERT INTO [beers] ([priority]) VALUES (1) select SCOPE_IDENTITY() AS GENERATED_KEYS
I've been having this issue for a while now and need some help. If anyone can point me in the right direction or try something I'd much appreciate it. Please let me know if you need any specific information that might help you.
Versions:
- activerecord-jdbc-adapter: 1.3.11
- SQL Server: 12.0.4213.0
- Rails: 4.1.0
- JRuby 1.7.12
I've just tried on a different version of SQL Server (10.0) and everything seems to be working. So maybe its a configuration issue?
probably (or a driver behaviour), recommend you look into as getting multiple SQL-Server versions setup is quite time consuming and personally do not have much time to be looking into a DB that I do not care.
I am having a similar problem over here:
https://github.com/jruby/activerecord-jdbc-adapter/issues/736
In my case, #replace_limit_offset! is clobbering my UPDATE statement with a SELECT! Could be same for you....
Not sure why changing the server version fixed the problem for you. Very interesting outcome...
I have had same problem with: Rails 3 JRuby 1.6 MSSQL 2008
I realized that the error disapear on restart the torquebox
Has anyone a workaround for that?
I was using the parameter SET NOCOUNT ON and forgetting the SET NOCOUNT OFF
https://stackoverflow.com/questions/22360730/sqlserverexception-a-result-set-was-generated-for-update