Sonar 5.6.4和6.1无法在新的MS SQL Server 2012上安装

时间:2017-01-17 13:15:13

标签: sql-server sonarqube sonarqube-ops

当我在新的(空的)MS SQL Server 2012数据库上启动Sonar时,它会运行一些失败的迁移代码。我在下面得到错误。如果有人能够在Sonar JIRA中创建问题,我可以提供完整的日志。在驱动程序端设置区域设置会有问题吗?

    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'

根据这个SQL Error: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value以及我使用MS SQL Server Management Studio的测试,它在日期和时间之间插入T时有效,即:     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' );

工作正常。不幸的是,我没有找到任何解决方法(任何驱动程序或环境设置)。到目前为止看起来它需要在声纳方面进行修复。

2 个答案:

答案 0 :(得分:2)

看起来为登录设置显式默认语言修复此问题:     ALTER LOGIN [登录名] WITH DEFAULT_LANGUAGE =英语 最好将其添加到安装说明中的故障排除中。

答案 1 :(得分:0)

在完成Marek Slama上面所说的之后,重新启动Sonar就不够了。

我试过了,你会收到另一个错误。

您应该从用于Sonar的架构中删除所有表和条目,然后重新启动该服务或再次运行Sonar。

这样,所有数据库都将正确创建,您应该没有问题。

要进行清洁,我建议您执行此脚本:Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement