Sonar + MS SQL数据库

时间:2012-11-03 10:10:06

标签: sql-server-2008 jdbc sonarqube sonar-runner

我正在尝试用mssql服务器数据库初始化声纳,但我不能。使用Microsoft SQL Server Management Studio,我使用用户名“sonar”和密码“sonar”创建了用户,并为“sonar”数据库授予了所有正确的权限。还将“服务器身份验证”配置为“SQL Server和Windows身份验证模式”。它工作正常,但我无法通过声纳与数据库建立连接。谢谢,

sonar.properties;

#----- Credentials
# Permissions to create tables and indexes must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username:                       sonar
sonar.jdbc.password:                       sonar

#----- Microsoft SQLServer
# The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on     http://jtds.sourceforge.net
sonar.jdbc.url:jdbc:sqlserver://localhost:1433;databaseName=SONAR;instanceName=r2;selectMethod=cursor
sonar.jdbc.driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
sonar.jdbc.validationQuery: select 1
sonar.jdbc.dialect: mssql

# Optional properties
#sonar.jdbc.driverClassName:                net.sourceforge.jtds.jdbc.Driver

#----- Connection pool settings
sonar.jdbc.maxActive:                      20
sonar.jdbc.maxIdle:                        5
sonar.jdbc.minIdle:                        2
sonar.jdbc.maxWait:                        5000
sonar.jdbc.minEvictableIdleTimeMillis:     600000
sonar.jdbc.timeBetweenEvictionRunsMillis:  30000
...

日志;

INFO   | jvm 1    | 2012/11/02 15:45:31 | JRuby limited openssl loaded. http://jruby.org/openssl
INFO   | jvm 1    | 2012/11/02 15:45:31 | gem install jruby-openssl for full support.
INFO   | jvm 1    | 2012/11/02 15:46:31 | 2012-11-02 15:46:31.368:WARN:/:unable to create shared     application instance
INFO   | jvm 1    | 2012/11/02 15:46:31 | org.jruby.rack.RackInitializationException: no connection available|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-    INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/connection.rb:61:in `initialize'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:31:in `initialize'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/connection_methods.rb:6:in `jdbc_connection'|?from org/jruby/RubyKernel.java:2056:in `send'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'|?from org/jruby/RubyKernel.java:1418:in `loop'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'|?from file:/C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/lib/jruby-complete-1.6.1.jar!/META-INF/jruby.home/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/migration.rb:435:in `initialize'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/migration.rb:400:in `up'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/config/../lib/database_version.rb:63:in `upgrade_and_start'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/config/../lib/database_version.rb:75:in `automatic_setup'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/config/environment.rb:131:in `(root)'|?from org/jruby/RubyKernel.java:1063:in `load'|?from C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/config/environment.rb:53:in `load_environment'|?from file:/C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/lib/jruby-rack-1.0.0.1.jar!/jruby/rack/rails.rb:46:in `to_app'|?from file:/C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/lib/jruby-rack-1.0.0.1.jar!/jruby/rack/rails.rb:191:in `new'|?from <script>:2:in `(root)'|?from org/jruby/RubyKernel.java:2021:in `instance_eval'|?from file:/C:/Users/eazakli/Desktop/sonar-3.2/sonar-3.2/war/sonar-server/WEB-INF/lib/jruby-rack-1.0.0.1.jar!/vendor/rack-1.2.1/rack/builder.rb:46:in `initialize'|?from <script>:2:in `(root)'|
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:184)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:59)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:27)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:40)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.Server.doStart(Server.java:224)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.sonar.application.JettyEmbedder.start(JettyEmbedder.java:72)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.sonar.application.StartServer.main(StartServer.java:48)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.tanukisoftware.wrapper.WrapperSimpleApp.run    (WrapperSimpleApp.java:240)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at java.lang.Thread.run(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 | 2012-11-02 15:46:31.381:WARN:/:Error: application initialization failed
INFO   | jvm 1    | 2012/11/02 15:46:31 | org.jruby.rack.RackInitializationException: unable to create shared application instance
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:39)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:40)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.jetty.Server.doStart(Server.java:224)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.sonar.application.JettyEmbedder.start(JettyEmbedder.java:72)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.sonar.application.StartServer.main(StartServer.java:48)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO   | jvm 1    | 2012/11/02 15:46:31 |   at java.lang.Thread.run(Unknown Source)
INFO   | jvm 1    | 2012/11/02 15:46:31 | 2012-11-02 15:46:31.434:INFO::Started     SelectChannelConnector@127.0.0.1:9000

1 个答案:

答案 0 :(得分:1)

很明显,声纳无法连接到SQL Server

可能有多种原因导致这种情况发生

  • 服务器名称拼写错误或端口号不正确。
  • SQL Server未配置为使用TCP / IP。从SQL Server的Ne​​twork Utility应用程序启用TCP / IP,或通过命名管道进行jTDS连接(有关如何执行此操作的信息,请参阅URL格式)。
  • 服务器上有防火墙阻塞端口1433。

要检查TCP / IP是否已启用且端口未被阻止,您可以使用“telnet 1433”。在telnet无法连接之前,jTDS也不会。如果您无法弄清楚原因,请向网络管理员寻求帮助

一般说法:在使用SQL Server设置Sonar时,使用Java SQL客户端(如Squirrel SQL)测试连接并尝试各种连接方式非常有帮助。这样,你知道是否要责怪Sonar对于任何问题。