Skip to content

Latest commit

 

History

History
85 lines (65 loc) · 2.23 KB

File metadata and controls

85 lines (65 loc) · 2.23 KB

Testing the Database GUI Application

Docker MySQL Container Setup

Your MySQL container is running on port 3307 with the following credentials:

Host: localhost
Port: 3307
Username: root
Password: testpassword
Database: testdb

Loading Sample Data

To populate the test database with sample data, run:

docker exec -i mysql-test mysql -uroot -ptestpassword testdb < sample-data.sql

This will create three tables:

  • users - 5 sample users
  • products - 8 sample products
  • orders - 5 sample orders

Using the Enhanced Connection Dialog

  1. Start the application:

    mvn javafx:run
  2. Click "Connect" button

  3. Test Connection:

    • The dialog is pre-filled with your Docker MySQL credentials
    • Click "Test Connection" button
    • Wait for the green success message
    • The Database dropdown will automatically populate with available databases
  4. Select Database:

    • Choose testdb from the dropdown (or any other database)
    • The "Connect" button will enable once a database is selected
  5. Connect:

    • Click "Connect" to establish the connection
    • The schema browser will load automatically

Sample Queries to Try

-- View all users
SELECT * FROM users;

-- View products by category
SELECT category, COUNT(*) as count, AVG(price) as avg_price
FROM products
GROUP BY category;

-- Join orders with users
SELECT u.username, o.total_amount, o.status, o.order_date
FROM orders o
INNER JOIN users u ON o.user_id = u.id
ORDER BY o.order_date DESC;

-- Find active users with their order count
SELECT u.username, u.email, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON u.user_id = o.id
WHERE u.is_active = TRUE
GROUP BY u.id, u.username, u.email;

Features to Test

Test Connection - Validates credentials and lists databases
Database Dropdown - Auto-populated after successful test
Schema Browser - Expand tables to see columns
SQL Syntax Highlighting - Keywords, strings, comments
Async Query Execution - Loading overlay during queries
Dynamic Results - Columns auto-generated from query
Execution Time - Displayed in status bar
Dark Mode UI - Nord/Dracula theme