SQL Problems after Changing DB Server
Asked by Matthias M?ller:

Hey everyone,  
i have a strange problem and i dont know how to solve it.  

For the "Setup":  
Actual Confluence 6.5(yes i know, thats why i am building the test stuff right now)  
MSSQL 2014 on an seperate machine  
No cloud or so  

"Clone" Enviroment  
Confluence 6.5  
MSSQL Express 22 with the Confluence DB in Compatibility Mode (SQL 2014)  

So i did the same thing before and it worked but now not.  

We cloned out Productive Confluence Windows Server into a new VM,  
after that i installed SQL Express.  
We made an Backup of the Live database which i restored to the SQL Express  

I changed the connection adress in the cfg  

Now Confluence crashed with the errors:  

<br />

2024-04-23 14:07:54,975 ERROR \[Catalina-utility-2\] \[engine.jdbc.spi.SqlExceptionHelper\] logExceptions Invalid object name 'BANDANA'.  

2024-04-23 14:07:55,022 ERROR \[Catalina-utility-2\] \[atlassian.confluence.plugin.BandanaPluginStateStore\] load Exception when loading plugins state from the database. Falling back to in memory state.  
java.util.concurrent.CompletionException: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL \[n/a\]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet  
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)  
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)  
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:824)  
at java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:834)  
at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2155)  
at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:110)  
at com.atlassian.confluence.impl.concurrency.CompletionStageUtils.foldResult(CompletionStageUtils.java:19)  
at com.atlassian.confluence.impl.vcache.SynchronousExternalCache.get(SynchronousExternalCache.java:236)  
at com.atlassian.confluence.setup.bandana.ConfluenceCachingBandanaPersister.retrieve(ConfluenceCachingBandanaPersister.java:78)  
at com.atlassian.confluence.setup.bandana.ConfluenceCachingBandanaPersister.retrieve(ConfluenceCachingBandanaPersister.java:71)  
at com.atlassian.bandana.DefaultBandanaManager.getValue(DefaultBandanaManager.java:32)  
at com.atlassian.bandana.DefaultBandanaManager.getValue(DefaultBandanaManager.java:24)  
at com.atlassian.confluence.plugin.BandanaPluginStateStore.lambda$load$1(BandanaPluginStateStore.java:57)  
at com.atlassian.confluence.tenant.TenantGate$3.call(TenantGate.java:145)  
at com.atlassian.confluence.plugin.BandanaPluginStateStore.load(BandanaPluginStateStore.java:69)  
at com.atlassian.confluence.plugin.CachingPluginStateStore.lambda$load$0(CachingPluginStateStore.java:44)  
at com.atlassian.vcache.internal.core.metrics.TimedSupplier.get(TimedSupplier.java:32)  
at com.atlassian.vcache.internal.legacy.LegacyJvmCache.lambda$get$4(LegacyJvmCache.java:52)  
at java.util.Optional.orElseGet(Optional.java:267)  
at com.atlassian.vcache.internal.legacy.LegacyJvmCache.get(LegacyJvmCache.java:50)  
at com.atlassian.vcache.internal.core.metrics.TimedLocalCacheOperations.get(TimedLocalCacheOperations.java:64)  
at com.atlassian.confluence.plugin.CachingPluginStateStore.load(CachingPluginStateStore.java:43)  
at com.atlassian.plugin.manager.PluginPersistentStateModifier.getState(PluginPersistentStateModifier.java:20)  
at com.atlassian.plugin.manager.DefaultPluginManager.getState(DefaultPluginManager.java:1092)  
at com.atlassian.plugin.manager.DefaultPluginManager.earlyStartup(DefaultPluginManager.java:540)  
at com.atlassian.confluence.plugin.ConfluencePluginManager.earlyStartup(ConfluencePluginManager.java:147)  
at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:72)  
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4682)  
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5143)  
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)  
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL \[n/a\]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet  
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:224)  
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:368)  
at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:315)  
at com.atlassian.confluence.setup.bandana.persistence.dao.hibernate.HibernateConfluenceBandanaRecordDao.getRecord(HibernateConfluenceBandanaRecordDao.java:42)  
at com.atlassian.confluence.setup.bandana.ConfluenceDaoBandanaPersister.retrieve(ConfluenceDaoBandanaPersister.java:29)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:498)  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)  
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)  
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)  
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)  
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)  
at com.sun.proxy.$Proxy54.retrieve(Unknown Source)  
at com.atlassian.confluence.setup.bandana.ConfluenceCachingBandanaPersister.lambda$retrieve$0(ConfluenceCachingBandanaPersister.java:80)  
at com.atlassian.confluence.impl.vcache.SynchronousExternalCache.lambda$get$11(SynchronousExternalCache.java:239)  
at com.atlassian.confluence.impl.concurrency.CompletionStageUtils.lambda$foldResult$0(CompletionStageUtils.java:19)  
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)  
... 36 more  
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet  
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)  
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)  
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)  
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)  
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:80)  
at org.hibernate.loader.Loader.getResultSet(Loader.java:2123)  
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1911)  
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)  
at org.hibernate.loader.Loader.doQuery(Loader.java:932)  
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)  
at org.hibernate.loader.Loader.doList(Loader.java:2615)  
at org.hibernate.loader.Loader.doList(Loader.java:2598)  
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)  
at org.hibernate.loader.Loader.list(Loader.java:2425)  
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)  
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:370)  
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)  
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1481)  
at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1441)  
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1410)  
at com.atlassian.confluence.setup.bandana.persistence.dao.hibernate.HibernateConfluenceBandanaRecordDao.lambda$getRecord$0(HibernateConfluenceBandanaRecordDao.java:46)  
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:361)  
... 56 more  
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'BANDANA'.  
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:260)  
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1547)  
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:528)  
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:461)  
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7342)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2688)  
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:224)  
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:204)  
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:383)  
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:379)  
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:71)  
... 73 more

I tried with the schema to change it to dbo and/or db_owner but still the same problem.  

I hope someone can help me, thanks in advance!


Answers:
author: Shawn Doyle - ReleaseTEAM
body: After you cloned the DB did you log into the Db and make sure the user has the correct rights?

Instructions can be found here: <https://confluence.atlassian.com/confkb/confluence-throws-an-invalid-object-name-bandana-error-701598601.html>

comments: author: Matthias M?ller
body: yeah, i checked. He has Sysadmin rights and is the DB Owner.  
I tried with

    ALTER USER <USER> WITH DEFAULT_SCHEMA = dbo;

and

    ALTER USER <USER> WITH DEFAULT_SCHEMA = db_owner;

since i am not 100% sure which schema is used here but the tables are saying db_owner  

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/320540i6432A051D106730D/image-size/large?v=v2&px=999 "image.png")  

Maybe thats the issue but i cant change that...  
![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/320541iD2FD6FCADC92A925/image-size/large?v=v2&px=999 "image.png")


Tags: confluence-data-center

data-center