When I start Sonar on fresh (empty) MS SQL Server 2012 DB it runs some migration code which fails. I get error below. I can provide full log if anyone is able to create issue in Sonar JIRA. Could it be problem with locale set on driver side?
2017.01.17 12:32:40 INFO web[DbMigration] == CreateDefaultUsersAndGroups: migrating ====================================
2017.01.17 12:32:40 INFO web[jruby.rack] An exception happened during JRuby-Rack startup
An error has occurred, this and all later migrations canceled:
ActiveRecord::JDBCError: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.: INSERT INTO [groups] ([name], [description], [created_at], [updated_at]) VALUES(N'sonar-administrators', N'System administrators', '2017-01-17 12:32:40', '2017-01-17 12:32:40')
2017.01.17 12:32:40 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.RubyRailsContextListener
org.jruby.rack.RackInitializationException: An error has occurred, this and all later migrations canceled:
ActiveRecord::JDBCError: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.: INSERT INTO [groups] ([name], [description], [created_at], [updated_at]) VALUES(N'sonar-administrators', N'System administrators', '2017-01-17 12:32:40', '2017-01-17 12:32:40')
from /apps/eqbld/eqsonar/sonarqube-5.6.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /apps/eqbld/eqsonar/sonarqube-5.6.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log'
from /apps/eqbld/eqsonar/sonarqube-5.6.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
from /apps/eqbld/eqsonar/sonarqube-5.6.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:222:in `insert_sql'
from /apps/eqbld/eqsonar/sonarqube-5.6.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:195:in `jdbc_insert'
According to this SQL Error: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value and my testing using MS SQL Server Management Studio it works when T is inserted between date and time ie this: INSERT INTO [groups] ([name], [description], [created_at], [updated_at]) VALUES(N'sonar-administrators', N'System administrators', '2017-01-17T13:45:01', '2017-01-17T13:45:01');
works fine. Unfortunately I did not find any workaround on my side (any driver or environment setting). So far it looks like it will require fix at Sonar side.