Configure Sonar Qube with Oracle

Hi

I am trying configure Sonar qube with Oracle as the back end.
Versions Used:-
Sonar Qube - 6.1
Oracle - 12.2
JDBC - OJDBC7

While running StartSONARLINT bat file, we are getting below error:-

2020.05.26 07:27:30 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:oracle:thin:@XXXXXX/XXXXX
2020.05.26 07:27:32 ERROR web[][o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.web.PlatformServletContextListener
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:104) ~[sonar-db-6.1.jar:na]
	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:71) ~[sonar-db-6.1.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_241]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_241]
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.15.jar:na]
	at org.sonar.core.platform.ComponentContainer$1.start(ComponentContainer.java:320) ~[sonar-core-6.1.jar:na]
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) ~[picocontainer-2.15.jar:na]
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) ~[picocontainer-2.15.jar:na]
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141) ~[sonar-core-6.1.jar:na]
	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:88) ~[sonar-server-6.1.jar:na]
	at org.sonar.server.platform.Platform.start(Platform.java:216) ~[sonar-server-6.1.jar:na]
	at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:175) ~[sonar-server-6.1.jar:na]
	at org.sonar.server.platform.Platform.init(Platform.java:90) ~[sonar-server-6.1.jar:na]
	at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:44) ~[sonar-server-6.1.jar:na]
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) [tomcat-embed-core-8.0.32.jar:8.0.32]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) [tomcat-embed-core-8.0.32.jar:8.0.32]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [tomcat-embed-core-8.0.32.jar:8.0.32]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [tomcat-embed-core-8.0.32.jar:8.0.32]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [tomcat-embed-core-8.0.32.jar:8.0.32]
	at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_241]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_241]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_241]
	at java.lang.Thread.run(Unknown Source) [na:1.8.0_241]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-01017: invalid username/password; logon denied
)
	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
	at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31) ~[sonar-db-6.1.jar:na]
	at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:323) ~[sonar-db-6.1.jar:na]
	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:102) ~[sonar-db-6.1.jar:na]
	... 30 common frames omitted
Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon denied

Hi @Vishal_Chheda,

You’re trying to use a very old verison of SonarQube. The minimum supported version is our 7.9 LTS. I would really recommend downloading and installing at least version 7.9. You can find the database requirements, including information on Oracle, in our documentation.

Regards,

Cameron.

Please help me…i am not able to configure with version of Sonar Qube

Hi @Vishal_Chheda,

If you absolutely have to install SonarQube 6.1, then you should look at the error message raised by the Oracle driver and check sonar.jdbc.username and sonar.jdbc.password in your sonar.properties file.

But as previously mentioned, the best path is to simply move to a supported version of SonarQube.

Best regards,

Cameron.

Thanks Cameron

Hi Cameron,

We are getting below error and we cannot change the character set of Oracle to UTF-8.
Will this still be a issue if i try to install sonar qube 7.9 LTS

Oracle must be have UTF8 charset and BINARY sort. NLS_CHARACTERSET is WE8MSWIN1252 and NLS_SORT is BINARY .

HI @Vishal_Chheda,

Yes, this will be an issue. Our requirements for 7.9 are listed here and they’re very clear that a character set from the UTF8 family is required.

Regards,

Cameron.

Also when i am installing 7.9, windows 32 bit version is not available for 7.9

Also 7.9 requires Java 11, whereas i have Java 8 installed.

Is there any workaround?

HI @Vishal_Chheda,

Support for 32 bit installations of the server was dropped in the 7.x series. You can have two versions of Java co-existing; just ensure your JAVA_HOME is pointing to the correct place for the user starting SonarQube.

Regards,

Cameron.

1 Like

Hi Cameron,

Thanks for the help. Can you also provide me some help on SONAR LINT
We have used SONAR LINT plug in in our project and we have baselined and suppressed existing issues. Now we want to integrate SONAR LINT with the local build, but when we integrate sonar lint with local build, it takes a lot of time and visual studio hangs

Can you please help…

Hi @Vishal_Chheda,

Let’s keep one topic per thread. If you need help on SonarLint, I suggest first browse existing posts over in the Get Help category for SonarLint. If you don’t find what you need, then open another thread there. But please be aware that the team is going to need more detail than “it takes a lot of time and visual studio hangs”. Quoting from the FAQ:

Please describe your issue with a maximum of details. We will likely ask you for:

  • your IDE flavor/version/OS. Exemple: Eclipse 2018-12 on MacOSX
  • SonarLint version
  • Are you using connected mode?
  • If you are using connected mode, what is the SonarQube server version (or say if it is SonarCloud)
  • If you are using connected mode, what are the installed analyzers. You can easily get a list by opening https://<SQ server>/api/plugins/installed in a Web browser.
  • The full stacktrace of the error, and logs with Verbose output and Analysis logs enabled. See IDE specific section to find how to get SonarLint logs.

Regards,

Cameron.