Skip to content

Interactive simulator for testing and visualizing SQL Server isolation level behaviors under concurrent transactions.

License

Notifications You must be signed in to change notification settings

ESMAaN/SqlIsolationLevelsSimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SqlIsolationLevelsSimulator

Interactive simulator for testing and visualizing SQL Server isolation level behaviors under concurrent transactions.

πŸš€ Features

  • Simulates concurrent database transactions
  • Demonstrates:
    • Dirty Reads
    • Non-repeatable Reads
    • Phantom Reads
    • Deadlocks
  • Visualizes the impact of different isolation levels
  • Calculates execution time and logs deadlock status

πŸ” Supported Isolation Levels

  • Read Uncommitted
  • Read Committed
  • Repeatable Read
  • Serializable

πŸ—ƒοΈ Required Database

This project uses the AdventureWorks2022 sample database to simulate real-world concurrent transactions.

πŸ’‘ Please download and restore the .bak file in your SQL Server instance before running the simulation.

πŸ“₯ Download AdventureWorks2022.bak
(Official link from Microsoft SQL Server Samples)

πŸ”„ Restore in SQL Server:

  1. Open SQL Server Management Studio (SSMS)
  2. Right-click Databases β†’ Restore Database
  3. Select the .bak file and restore it as AdventureWorks2022

πŸ› οΈ Technologies Used

  • C# (.NET Framework) – UI and transaction simulation logic
  • SQL Server – For executing concurrent transactions
  • ADO.NET – Database access and command execution
  • Windows Forms – User interface
  • Multithreading – Simulating parallel operations

▢️ Getting Started

🧱 Prerequisites

  • Visual Studio 2019 or newer
  • SQL Server (Express or LocalDB)
  • AdventureWorks2022 sample database

βš™οΈ Setup

  1. Clone the repository:
git clone https://github.com/your-username/SqlIsolationLevelsSimulator.git
  1. Open SqlIsolationLevelsSimulator.sln in Visual Studio

  2. Make sure SQL Server is running and the AdventureWorks2022 database is restored

  3. Update App.config if needed:

<connectionStrings>
  <add name="DefaultConnection"
       connectionString="Data Source=localhost;Initial Catalog=AdventureWorks2022;Integrated Security=True" />
</connectionStrings>
  1. Run the app with F5

πŸ“Š Example Output

  • Isolation Level: Repeatable Read
  • Transaction A: Update operation
  • Transaction B: Select β†’ Delay β†’ Select again
  • ❌ Deadlock: No
  • ⏱ Execution Time: 426 ms

πŸ‘€ Author

Esma Şen

About

Interactive simulator for testing and visualizing SQL Server isolation level behaviors under concurrent transactions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages