Skip to content

jorisros/queryWorker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Database GUI - Professional JavaFX Query Tool

A production-ready, cross-platform database management application built with JavaFX 21, featuring a modern dark UI, real-time SQL syntax highlighting, async query execution, and support for MySQL and Microsoft SQL Server.

✨ Features

  • 🎨 Modern Dark UI: Nord/Dracula-inspired theme with smooth transitions
  • ✍️ SQL Editor: Real-time syntax highlighting with RichTextFX
  • ⚑ Async Query Execution: Non-blocking queries with loading overlay
  • πŸ—‚οΈ Schema Browser: TreeView with tables and columns
  • πŸ“Š Dynamic Results: TableView with automatic column generation
  • πŸ”Œ Connection Pooling: HikariCP for optimal performance
  • πŸ—„οΈ Multi-Database: MySQL and MSSQL support

πŸš€ Quick Start

Prerequisites

  • Java 21 or higher
  • Maven 3.8+
  • MySQL or Microsoft SQL Server database

Build & Run

# Clone or navigate to the project directory
cd queryWorkerJava

# Build the project
mvn clean package

# Run the application
mvn javafx:run

πŸ“– Usage

Connecting to a Database

  1. Click Connect button or use File β†’ Connect
  2. Select database type (MySQL or MSSQL)
  3. Enter connection details:
    • Host (e.g., localhost)
    • Port (default: 3306 for MySQL, 1433 for MSSQL)
    • Database name
    • Username and password
  4. Click Connect

Executing Queries

  1. Type your SQL query in the editor
  2. Press Ctrl+Enter or click Execute
  3. View results in the table below
  4. Check execution time in the status bar

Schema Browser

  • Expand the tree to view tables
  • Click on a table to see its columns
  • Use Refresh Schema to update the tree

πŸ—οΈ Architecture

Project Structure

queryWorkerJava/
β”œβ”€β”€ src/main/java/
β”‚   └── nl/
β”‚       └── jorisros/
β”‚           └── queryworker/
β”‚               β”œβ”€β”€ MainApp.java                    # Application entry point
β”‚               β”œβ”€β”€ config/                         # Dependency injection (Guice)
β”‚               β”‚   └── AppModule.java
β”‚               β”œβ”€β”€ controller/
β”‚               β”‚   β”œβ”€β”€ MainController.java         # Primary UI logic
β”‚               β”‚   └── QueryPanelController.java   # Tab-specific logic
β”‚               β”œβ”€β”€ model/
β”‚               β”‚   β”œβ”€β”€ ConnectionStore.java        # Connection persistence
β”‚               β”‚   └── DatabaseConnection.java     # Connection configuration
β”‚               β”œβ”€β”€ service/
β”‚               β”‚   β”œβ”€β”€ ConnectionManager.java      # HikariCP pool management
β”‚               β”‚   β”œβ”€β”€ DatabaseService.java        # Async query execution
β”‚               β”‚   β”œβ”€β”€ ThemeManager.java           # Theme switching logic
β”‚               β”‚   └── git/                        # Git integration
β”‚               β”œβ”€β”€ view/
β”‚               β”‚   β”œβ”€β”€ ErdView.java                # ER Diagram visualizer
β”‚               β”‚   └── SettingsDialog.java         # App settings
β”‚               β”œβ”€β”€ component/
β”‚               β”‚   β”œβ”€β”€ SqlEditor.java              # RichTextFX editor wrapper
β”‚               β”‚   └── LoadingOverlay.java         # Progress indicator
β”‚               └── database/                       # Database provider adapters
β”‚                   β”œβ”€β”€ mysql/
β”‚                   └── mssql/
β”œβ”€β”€ src/main/resources/
β”‚   β”œβ”€β”€ application.properties
β”‚   └── nl/
β”‚       └── jorisros/
β”‚           └── queryworker/
β”‚               β”œβ”€β”€ view/
β”‚               β”‚   β”œβ”€β”€ MainView.fxml               # Main layout
β”‚               β”‚   └── QueryPanel.fxml             # Tab layout
β”‚               └── styles/
β”‚                   β”œβ”€β”€ dark-mode.css               # Theme definitions
β”‚                   └── erd-view.css                # ERD specific styles
└── pom.xml

Key Technologies

Technology Purpose
JavaFX 21 Modern UI framework
RichTextFX Advanced code editor with syntax highlighting
HikariCP High-performance JDBC connection pooling
MySQL Connector/J MySQL database driver
MSSQL JDBC Driver Microsoft SQL Server driver

🎨 UI Components

SQL Editor

  • Syntax Highlighting: Keywords, strings, comments, numbers
  • Line Numbers: Built-in line numbering
  • Keyboard Shortcuts: Ctrl+Enter to execute

Results Table

  • Dynamic Columns: Auto-generated from ResultSetMetaData
  • Virtualization: Efficient rendering for large datasets
  • Row Count: Display total rows returned

Loading Overlay

  • Fade Animations: Smooth show/hide transitions
  • Progress Indicator: Visual feedback during query execution

βš™οΈ Configuration

HikariCP Settings

Edit src/main/resources/application.properties:

hikari.maximumPoolSize=10
hikari.minimumIdle=2
hikari.connectionTimeout=30000
hikari.idleTimeout=600000
hikari.maxLifetime=1800000

Database Connection

The application supports:

  • MySQL: jdbc:mysql://host:port/database
  • MSSQL: jdbc:sqlserver://host:port;databaseName=database

πŸ”§ Development

Building from Source

# Compile only
mvn compile

# Run tests (if any)
mvn test

# Package as JAR
mvn package

# Clean build artifacts
mvn clean

Running with Custom JVM Options

mvn javafx:run -Djavafx.args="--enable-preview"

πŸ“ Example Queries

-- Select all records
SELECT * FROM users LIMIT 100;

-- Join tables
SELECT o.id, c.name, o.total
FROM orders o
INNER JOIN customers c ON o.customer_id = c.id
WHERE o.status = 'completed';

-- Aggregate functions
SELECT 
    category,
    COUNT(*) as count,
    AVG(price) as avg_price
FROM products
GROUP BY category
ORDER BY count DESC;

🎯 Keyboard Shortcuts

Shortcut Action
Ctrl+Enter Execute query
Ctrl+Q Quit application

πŸ› Troubleshooting

Connection Issues

  • Verify database is running
  • Check firewall settings
  • Ensure JDBC driver is compatible
  • Validate credentials

Performance

  • Adjust HikariCP pool size in application.properties
  • Use LIMIT clause for large result sets
  • Enable database query caching

πŸ“„ License

This project is provided as-is for educational and professional use.

πŸ™ Acknowledgments

  • JavaFX - Modern Java UI framework
  • RichTextFX - Rich text editing for JavaFX
  • HikariCP - Lightning-fast connection pooling
  • Nord Theme - Beautiful color palette inspiration

About

My first Vibe project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages