SonarQube Error Connection


(Hugo) #1

Hello.

I am trying to connect my SonarQube 7.2.1 Community to a SQL Server which is in another machine.

In my sonar.properties I have this:

sonar.jdbc.username=SonarQube
sonar.jdbc.password=mypassword
sonar.jdbc.url=jdbc:sqlserver://JBPASQLAG005:5023;databaseName=SonarQube6

I get this error:

2019.01.08 16:15:09 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2019.01.08 16:15:10 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2019.01.08 16:15:12 INFO  web[][o.e.p.PluginsService] no modules loaded
2019.01.08 16:15:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2019.01.08 16:15:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2019.01.08 16:15:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.01.08 16:15:15 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.01.08 16:15:15 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.2.1.14109 / ec3b36b6cbe32cd9f53fa82c7ba617c703a18e4c
2019.01.08 16:15:15 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://JBPASQLAG005:5023;databaseName=SonarQube6
2019.01.08 16:15:30 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:108)
	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:75)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
	at org.sonar.server.platform.Platform.start(Platform.java:211)
	at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:170)
	at org.sonar.server.platform.Platform.init(Platform.java:86)
	at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:45)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection reset ClientConnectionId:f1473004-ce68-43fa-ad81-b185b86b7ccb)
	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
	at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:322)
	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:106)
	... 29 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset ClientConnectionId:f1473004-ce68-43fa-ad81-b185b86b7ccb
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2435)
	at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1991)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:2166)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2018)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1687)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1528)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:866)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:569)
	at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
	at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
	at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
	... 34 common frames omitted
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocketInputStream.read(Unknown Source)
	at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1981)
	... 44 common frames omitted

Can anyone help me with this?
Why am I getting an error.


(G Ann Campbell) #2

Hi,

These may help:

 
Ann


(Hugo) #3

Thanks I am trying to do it.

I am trying to connect to a SQL Server in a different machine (not the same machine where I have installed SonarQube) using Port 5023.
I have more than an instance of SQL.

Can you confirm that I am using the correct connection string?

"
sonar.jdbc.username=SonarQube
sonar.jdbc.password=mypassword
sonar.jdbc.url=jdbc:sqlserver://JBPASQLAG005:5023;databaseName=SonarQube6
"


(Hugo) #4

I still could connect my SonnarQube 7.2.1 Community to My SQL Server 2016 Always On.
Could you give me further help please?


(G Ann Campbell) #5

Hi,

Are you getting the same error you were before? Googling indicated to me that your DB wasn’t accepting connections. That’s why I sent you the links I did.

 
Ann