This application demonstrates lock-based synchronization in RDBMS. It connects twice to a specified database instance. You can then run SQL statements against the two different connections, monitor the locks that are held, and watch the effects.
The application is packaged with an Apache Derby runtime, which allows you to run against an in-memory Derby database.
- Dual Connection Panels: Execute SQL on two separate database connections simultaneously
- Real-time Lock Monitoring: View active locks and their states in real-time
- Multiple Isolation Levels: Test different transaction isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable)
- Transaction Control: Commit and rollback transactions independently on each connection
Ctrl+N- New scriptCtrl+O- Open scriptCtrl+S- Save scriptCtrl+Shift+S- Save script asAlt-1- Execute SQLAlt-2- Next rowAlt-3- Update rowAlt-4- CommitAlt-5- Rollback
Ctrl+Alt+N- New scriptCtrl+Alt+O- Open scriptCtrl+Alt+S- Save scriptCtrl+Alt+Shift+S- Save script asAlt-6- Execute SQLAlt-7- Next rowAlt-8- Update rowAlt-9- CommitAlt-0- Rollback
- Apache Derby (embedded, included)
- IBM DB2 (requires DB2 JDBC driver)
mvn clean packageThis creates target/lockdemo.jar with all dependencies included.
java -jar target/lockdemo.jarFor DB2 connections, ensure DB2 JDBC drivers are in the classpath.
- Connect to Database: Enter JDBC URL and click "Connect" on both panels
- Set Isolation Level: Choose the desired isolation level for each connection
- Load or Write SQL: Use the Script Manager to load a saved scenario or write SQL directly
- Execute Statements: Run SQL on one or both connections
- Monitor Locks: Watch the lock table at the bottom to see active locks
- Test Scenarios: Commit or rollback to observe lock behavior
- User's Guide - Comprehensive documentation covering all features
- Script Manager Guide - Detailed guide for the Script Manager feature
- Lock Conflict Highlighting: Color-coded lock display (red=conflict, orange=waiting, pink=exclusive, green=shared)
- Enhanced SQL Editor: Syntax highlighting, line numbers, auto-completion (60+ keywords)
- SQL Formatting: Format SQL with Ctrl+Shift+F
- Theme Support: Light, IntelliJ, and Dark themes with persistence
- Improved Resource Management: Proper cleanup of connections and threads
- Enhanced Wait Detection: Better detection of waiting locks across databases
- Added Script Manager functionality
- Added menu bar with File operations
- Improved keyboard shortcuts
- Added unsaved changes protection
- Enhanced SQL script parsing with comment support