Migrate from H2 to SQL Azure database

Currently I am using 8.3
pointed to h2 database,

Want to migrate to sql azure database in azure sql app service.

Passed connection string in config file
Passed in the sonar properties,

But it is not accepting
Checked in the powershell, sqlcmd connection is getting established.

Any pointers will be great

.

Hello @govi71 and welcome to the community :wave:

migrating from the h2 database to any other database is not supported by sonarsource. this is the reason we display a big warning when you start SQ with the h2 database that this database is only meant for evaluation purposes.

if you are already aware that you will loose your data and are currently having trouble to connect to a external database, maybe i can help you if you share some more information about your setup, the error message you are facing and the log files that are generated during your attempts.

Thank you, here is the details

Currently, I have installed 8.9.1 version of sonarqube by referring the below url GitHub - vanderby/SonarQube-AzureAppService: Instructions and files to host SonarQube on an Azure App Service without a container. ,

It is a fresh test instance, where i need to migrate from H2 to mssql database

When i change the connection strings in the sonar.properties file it is overritten and h2 default database is loaded.

I stopped the app service.
Deleted data - e7 folder
modified the sonar properties file and pointed to sql connection string.
Navigated to bin - windows- startsonar.bat

In this way i was able to boot the instance.

I have uploaded auth.dll and also the java.11.jar in the appropriate folders.

But, getting connect to database failed,
Below is the log for reference.

java.lang.IllegalStateException: Fail to connect to database
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:86)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
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:136)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:166)
at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
at org.sonar.server.platform.PlatformImpl.startLevel1Container(PlatformImpl.java:172)
at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:86)
at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4705)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5171)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: 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:118)
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:83)
… 24 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (The TCP/IP connection to the host xxxxxxx.database.windows.net,1433, port 1433 has failed. Error: “xxxxxxx.database.windows.net,1433. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.”.)

=============================================

I have

Hmm as this is coming from a 3rd party project, i would suggest to ask them as well regarding this part here:

because i assume that this is not related to sonarqube directly but to the way SQ was deployed.

Regarding your database connection; did you already check:

because to me it looks like SQ is trying to connect to the database you configured but can not establish a connection to it