Get error when executing Update-Database in Code First EF - ef-code-first

Im using Entity Framework and Code First. Connections to db works fine until i want to create a new Migration. Keep getting this error:
A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
Normal read and write to the tables works fine.
I can also execute a rollback with line
Update-Database -TargetMigration xxx
Only the forward way I gives me trouble

Related

Would could cause a Postgres exception: 42501: must be a member of the role whose process is being terminated or member of pg_signal_backend?

I've been running component tests in a .NET 5 application using LightBDD. In each test we bring up an instance of an ASP .NET core "application" that we connect to via grpc. At the end of each test we shut down the "application".
This "application" starts a connection to a Postgres instance (in the tests this is constantly running locally in Docker and is not restarted between tests) and then closes it at shutdown.
In a sequential run of 30 tests I got the following error twice (separated by about 5 successful tests):
Postgres exception: 42501: must be a member of the role whose process is being terminated or member of pg_signal_backend
I haven't been able to reproduce it since. Does anyone know what potentially could have caused this intermittant issue?
You get that error if you are trying to cancel a transaction of a different database session or terminate such a session, but that other session is with a different database user.
The error message informs you what privileges you need to do that: you either have to be the same user (or a member thereof), or a member of pg_signal_backend or a superuser.

Why does this Visual Studio warning / problem occur?

I get this error whenever I want to access the database that I have created and it shows this message
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed
Does anyone know how to solve this?

SQLite Exception when trying to open a connection with multiple processes

My scenario is simple, I have one process generating some data and putting it into the database (currently 5 seconds after the last one is finished) and then there are any number of processes opening a connection to read a single record to use internally (currently 5 seconds after the last one is finished). The database is located on the local drive and the OS is Windows Server 2012 R2.
With the reader processes I am occasionally receiving an error when connecting to the sqlite database, when the connection is opened an [FireDAC][Phys][SQLite] ERROR: unable to close due to unfinalized statements or unfinished backups exception is thrown and I'm stumped on the cause and the meaning of the error message (in the case of opening a connection).
My connection is created like so (in both the reader and writer application):
connection := TFDConnection.Create(nil);
connection.Params.Add('DriverID=SQLite');
connection.Params.Add('Database=' + aDatabasePath);
connection.Params.Add('OpenMode=CreateUTF16');
connection.Params.Add('LockingMode=Normal');
connection.Params.Add('JournalMode=WAL');
connection.Params.Add('Synchronous=Full');
connection.Params.Add('UpdateOptions.LockWait=True');
connection.Params.Add('BusyTimeout=30000');
connection.Params.Add('SQLiteAdvanced=temp_store=MEMORY');
connection.Params.Add('SQLiteAdvanced=page_size=4096');
connection.Params.Add('SQLiteAdvanced=auto_vacuum=FULL');
connection.Open();
After investigating the EFDDBEngineException that gets thrown there is only a single error in the list of errors and it contains ErrorCode=5 which sqlite errorcodes and sqlite result codes say are the SQLITE_BUSY error.
Investigating the callstack
ntdll.dll KiUserExceptionDispatcher
FireDAC.Phys.SQLite TFDPhysSQLiteConnection.InternalDisconnect
FireDAC.Phys TFDPhysConnection.ConnectBase
ntdll.dll KiUserExceptionDispatcher
FireDAC.Phys.SQLiteWrapper TSQLiteStatement.PrepareBase
FireDAC.Phys.SQLiteWrapper TSQLiteStatement.Prepare
FireDAC.Phys.SQLiteWrapper TSQLiteStatement.Prepare
FireDAC.Phys.SQLite TFDPhysSQLiteConnection.InternalExecuteDirect
FireDAC.Phys.SQLite SetPragma
FireDAC.Phys.SQLite TFDPhysSQLiteConnection.InternalConnect
FireDAC.Phys TFDPhysConnection.ConnectBase
FireDAC.Phys TFDPhysConnection.DoConnect
FireDAC.Phys TFDPhysConnection.Open
FireDAC.Comp.Client TFDCustomConnection.DoInternalLogin
FireDAC.Comp.Client TFDCustomConnection.DoLogin
FireDAC.Comp.Client TFDCustomConnection.DoConnect
Data.DB TCustomConnection.SetConnected
FireDAC.Comp.Client TFDCustomConnection.SetConnected
Data.DB TCustomConnection.Open
It's obviously not liking something that is happening in TSQLiteStatement.PrepareBase which then results in TFDPhysConnection.ConnectBase attempting to cleanup whatever point the creating of the connection is up to but where would the unfinalized statement be?
I Close() and Free() every TFDQuery and the connection when I'm finished.
What am I missing?
On a side note because it is a problem for me. Once the error occurs the WAL and SHM files don't get collapsed into the database file, and if I try to run the reader application on my dev machine under the debugger pointing at the database in the shared folder it locks completely when trying to open a connection and ending all other readers and the writer process doesn't unlock it and then I need to restart my dev machine.

Update SQL database Failed when deploying

I have a Web Application(ASP.NET Core project) with two migrations and I published it to Azure. At the end I got a message that Web App was published successfully but I see these warnings in output console:
Info: Adding database (data source=tcp:xxxdbserver.database.windows.net,1433;initial catalog=xxx_db;user id=yyy#xxxdbserver)
Warning: Cannot connect to the database 'xxx_db'.
Retrying operation 'Add' on object dbFullSql (data source=tcp:xxxdbserver.database.windows.net,1433;initial catalog=xxx_db;user id=yyy#xxxdbserver). Attempt 1 of 20.
Warning: The database 'xxx_db' could not be created.
Retrying operation 'Add' on object dbFullSql (data source=tcp:xxxdbserver.database.windows.net,1433;initial catalog=xxx_db;user id=yyy#xxxdbserver). Attempt 2 of 20.
Info: Using ID 'zzz' for connections to the remote server.
Info: Adding file (xxx\appsettings.json).
Info: Adding file (xxx\appsettings.Production.json).
And when I am looking in Database Activity Log on Azure Portal I see one failed operation with the following summary:
Operation name
Update SQL database
Time stamp
Sat Oct 22 2016 20:56:26 GMT+0300 (GTB Daylight Time)
Error code
40619
Message
The edition 'Free' does not support the database max size '1073741824'.
I never set a database max size. The strange thing is that everything is working fine in the app online. Was that a failed operation and it eventually succeeded? Where is this coming from?

Debug an orchestration in biztalk 2010

I'm making an orchestration to send data from one SQL Server DB to another one. I'm able to receive the data but unable to send it to the other DB. I made a send port to test what I'm getting as an input. I got to know that I'm not getting the right data from the source schema. I have tested the map from visual studio 2010, and it is working fine. But i'm getting following error in event viewer:
The adapter "SQL" raised an error message. Details "HRESULT="0x80040e14"
Description="SQLOLEDB Error Description: Empty update, no updatable rows found Transaction aborted "
<Root xmlns:ns00="urn:schemas-microsoft-com:xml-updategram">
<?MSSQLError HResult="0x80040e14" Source="Microsoft OLE DB Provider for SQL Server" Description="SQLOLEDB Error Description: Empty update, no updatable rows found Transaction aborted "?>
</Root>".
I want debug the orchestration. How can I do so?
Via the admin console you can view the suspended orchestration and set break points. The future runs of the orchestration will hold at the break point and again through the admin console you can attach to the orchestration and view information such as message content.

Resources