Installation issue "Setup failed: could not execute query"

Topics: Installing Orchard
Jan 29, 2013 at 12:35 PM

We have two Orchard installations on an IIS box connecting to sql 2005 databases working absolutely fine.

We're trying to add a third using the exact same setup only the installation is failing returning the following error:

Setup failed: could not execute query
[ select rolerecord0_.Id as Id13_, rolerecord0_.Name as Name13_ from Orchard_Roles_RoleRecord rolerecord0_ where rolerecord0_.Name=@p0 ]
Name:p1 - Value:Anonymous
[SQL: select rolerecord0_.Id as Id13_, rolerecord0_.Name as Name13_ from Orchard_Roles_RoleRecord rolerecord0_ where rolerecord0_.Name=@p0]

We just created a very simple test application using the same connection string as we're entering and the db permissions allowed it to connect, create, query and drop tables so we're fairly sure the db user is fine.

Whilst running the install we've noticed there is no settings.txt file being created so considered a permissions issue (although some other files are created) but the ApplicationPoolIdentity does have full permissions on the app_data folder.

Any guidance very gratefully received

Dan

Full error log below:

2013-01-29 12:19:43,312 [8] NHibernate.Util.ADOExceptionReporter - Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
2013-01-29 12:19:43,328 [8] NHibernate.Event.Default.AbstractFlushingEventListener - Could not synchronize database state with session
NHibernate.Exceptions.GenericADOException: could not execute batch command.[SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Data.SqlClient.SqlCommand.ExecuteBatchRPCCommand()
   at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()
   at NHibernate.AdoNet.SqlClientSqlCommandSet.ExecuteNonQuery()
   at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
   --- End of inner exception stack trace ---
   at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
   at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)
   at NHibernate.AdoNet.SqlClientBatchingBatcher.AddToBatch(IExpectation expectation)
   at NHibernate.Persister.Collection.AbstractCollectionPersister.PerformInsert(Object ownerId, IPersistentCollection collection, IExpectation expectation, Object entry, Int32 index, Boolean useBatch, Boolean callable, ISessionImplementor session)
   at NHibernate.Persister.Collection.AbstractCollectionPersister.Recreate(IPersistentCollection collection, Object id, ISessionImplementor session)
   at NHibernate.Action.CollectionRecreateAction.Execute()
   at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
   at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
   at NHibernate.Engine.ActionQueue.ExecuteActions()
   at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
2013-01-29 12:19:43,359 [8] NHibernate.Transaction.ITransactionFactory - DTC transaction prepre phase failed
NHibernate.Exceptions.GenericADOException: could not execute batch command.[SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
Invalid column name 'ContentTypeDefinitionRecord_id'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Data.SqlClient.SqlCommand.ExecuteBatchRPCCommand()
   at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()
   at NHibernate.AdoNet.SqlClientSqlCommandSet.ExecuteNonQuery()
   at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
   --- End of inner exception stack trace ---
   at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
   at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)
   at NHibernate.AdoNet.SqlClientBatchingBatcher.AddToBatch(IExpectation expectation)
   at NHibernate.Persister.Collection.AbstractCollectionPersister.PerformInsert(Object ownerId, IPersistentCollection collection, IExpectation expectation, Object entry, Int32 index, Boolean useBatch, Boolean callable, ISessionImplementor session)
   at NHibernate.Persister.Collection.AbstractCollectionPersister.Recreate(IPersistentCollection collection, Object id, ISessionImplementor session)
   at NHibernate.Action.CollectionRecreateAction.Execute()
   at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
   at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
   at NHibernate.Engine.ActionQueue.ExecuteActions()
   at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
   at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
   at NHibernate.Impl.SessionImpl.Flush()
   at NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.DistributedTransactionContext.System.Transactions.IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)
2013-01-29 12:19:43,702 [8] NHibernate.AdoNet.AbstractBatcher - Could not execute query: select shellstate0_.Id as Id6_, shellstate0_.Unused as Unused6_ from Settings_ShellStateRecord shellstate0_ where shellstate0_.Id is not null
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Settings_ShellStateRecord'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
2013-01-29 12:19:43,702 [8] NHibernate.Util.ADOExceptionReporter - Invalid object name 'Settings_ShellStateRecord'.
2013-01-29 12:19:43,702 [8] NHibernate.Util.ADOExceptionReporter - Invalid object name 'Settings_ShellStateRecord'.
2013-01-29 12:19:43,702 [8] NHibernate.Util.ADOExceptionReporter - Invalid object name 'Settings_ShellStateRecord'.
2013-01-29 12:19:43,702 [8] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.Exceptions.GenericADOException: could not execute query
[ select shellstate0_.Id as Id6_, shellstate0_.Unused as Unused6_ from Settings_ShellStateRecord shellstate0_ where shellstate0_.Id is not null ]
[SQL: select shellstate0_.Id as Id6_, shellstate0_.Unused as Unused6_ from Settings_ShellStateRecord shellstate0_ where shellstate0_.Id is not null] ---> System.Data.SqlClient.SqlException: Invalid object name 'Settings_ShellStateRecord'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
   --- End of inner exception stack trace ---
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
   at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
   at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
   at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
   at NHibernate.Impl.ExpressionQueryImpl.List()
   at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
   at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
   at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
   at Orchard.Data.Repository`1.Get(Expression`1 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:line 91
   at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Get(Expression`1 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:line 60
   at Orchard.Core.Settings.State.ShellStateManager.GetShellState() in c:\Users\sebros\My Projects\Orchard\src\Orchard.Web\Core\Settings\State\ShellStateManager.cs:line 22
   at Orchard.Environment.State.ShellStateCoordinator.Orchard.Environment.State.IShellStateManagerEventHandler.ApplyChanges() in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\State\ShellStateCoordinator.cs:line 108
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Events\DefaultOrchardEventBus.cs:line 80
   at Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Events\DefaultOrchardEventBus.cs:line 68
   at Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, IEnumerable& returnValue) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Events\DefaultOrchardEventBus.cs:line 52
2013-01-29 12:19:44,232 [8] NHibernate.AdoNet.AbstractBatcher - Could not execute query: select rolerecord0_.Id as Id13_, rolerecord0_.Name as Name13_ from Orchard_Roles_RoleRecord rolerecord0_ where rolerecord0_.Name=@p0
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Orchard_Roles_RoleRecord'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.AdoNet.AbstractBatcher.Execute

Jan 29, 2013 at 2:54 PM

Database Collation turned out to be the culprit! Orchard requires it be case insensitive (CI).