Skip to main content

Overview

This guide covers common issues you may encounter while using the MySQL SQL Editor, along with their solutions based on the application’s error handling logic.

Connection Issues

Symptoms

Error message in login view:
Error de conexión: Connection refused
or
Error: Communications link failure

Root Causes

Source: Model.java:54-58 - DriverManager.getConnection() fails
  1. MySQL Server Not Running
    • The MySQL service is stopped
    • The server crashed or failed to start
  2. Wrong Server Address
    • Selected server is not running MySQL
    • Firewall blocking port 3306
  3. Port Already in Use
    • Another service is using port 3306
    • MySQL is running on a different port

Solutions

1

Verify MySQL is Running

Linux/macOS:
sudo systemctl status mysql
# or
sudo service mysql status
Windows:
net start | find "MySQL"
Start MySQL if needed:
sudo systemctl start mysql  # Linux
net start MySQL80           # Windows
2

Check MySQL Port

Verify MySQL is listening on port 3306:
netstat -an | grep 3306
# or
lsof -i :3306
The application only supports port 3306. If your MySQL server uses a different port, you’ll need to modify the connection string in Model.java:28 and Model.java:54-55.
3

Test Connection Manually

Use the MySQL command-line client:
mysql -h localhost -u root -p
If this fails, the issue is with MySQL configuration, not the application.

Symptoms

Error message in login view:
Error: Access denied for user 'username'@'localhost' (using password: YES)

Root Causes

Source: Model.java:26-42 (database discovery), Model.java:53-59 (connection)
  1. Invalid Username
    • Username does not exist in MySQL
    • Typo in username field
  2. Incorrect Password
    • Wrong password entered
    • Password contains special characters not properly entered
  3. User Permissions
    • User exists but doesn’t have required privileges
    • User is restricted to specific hosts

Solutions

1

Verify Credentials

Test credentials with MySQL CLI:
mysql -h localhost -u [username] -p
# Enter password when prompted
2

Check User Privileges

If login works via CLI, check user permissions:
SHOW GRANTS FOR 'username'@'localhost';
Required privileges:
  • SELECT - For query execution
  • INSERT, UPDATE, DELETE - For data modification
  • CREATE, DROP, ALTER - For schema changes
  • SHOW DATABASES - For database discovery (required)
3

Reset Password (if needed)

ALTER USER 'username'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;
The application trims whitespace from username and password (View.java:188, View.java:191). Leading/trailing spaces will be removed automatically.

Symptoms

After clicking “Actualizar”, the database combo box remains empty with error:
No se encontraron bases de datos

Root Causes

Source: Model.java:36-38 - System databases are filtered out
  1. No User Databases
    • Only system databases exist (information_schema, mysql, performance_schema, sys)
    • All user databases were dropped
  2. Insufficient Privileges
    • User cannot execute SHOW DATABASES
    • User has access but grants are not visible

Solutions

1

Check Existing Databases

Connect via MySQL CLI and run:
SHOW DATABASES;
Verify that databases other than system databases exist.
2

Create a Test Database

CREATE DATABASE test_db;
Then click “Actualizar” in the application.
3

Verify SHOW DATABASES Privilege

SHOW GRANTS FOR CURRENT_USER();
Grant if needed:
GRANT SHOW DATABASES ON *.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
The filter regex is: information_schema|mysql|performance_schema|sys (Model.java:36). Databases matching these patterns are never shown.

Symptoms

Application freezes or shows error after long wait:
Error: Connection timed out

Root Causes

Source: Async operations in Controller.java
  1. Network Issues
    • Slow or unreliable network connection
    • Remote server not responding
  2. Server Overload
    • MySQL server is under heavy load
    • Too many concurrent connections
  3. Firewall/Proxy
    • Firewall dropping packets
    • Proxy interfering with connection

Solutions

1

Test Network Connectivity

ping [server_address]
telnet [server_address] 3306
2

Check MySQL Connection Limit

SHOW VARIABLES LIKE 'max_connections';
SHOW STATUS LIKE 'Threads_connected';
Increase if needed:
SET GLOBAL max_connections = 200;
3

Increase Timeout (requires code change)

Modify connection URL in Model.java:28 or Model.java:54-55:
String url = "jdbc:mysql://" + host + ":3306/" + database 
           + "?useSSL=false&connectTimeout=10000";

Symptoms

Warning or error about SSL certificate:
Error: SSL connection error

Root Cause

Source: Model.java:28, Model.java:54-55 - useSSL=false parameterMySQL server requires SSL but application disables it.

Solution

1

Check MySQL SSL Requirement

SHOW VARIABLES LIKE 'require_secure_transport';
If ON, SSL is required.
2

Enable SSL in Application (requires code change)

Modify Model.java:Change:
String url = "jdbc:mysql://" + host + ":3306/" + database + "?useSSL=false";
To:
String url = "jdbc:mysql://" + host + ":3306/" + database 
           + "?useSSL=true&requireSSL=true";
3

Disable SSL on MySQL Server (not recommended for production)

SET GLOBAL require_secure_transport = OFF;
Disabling SSL in production environments is a security risk. Only use useSSL=false for local development.

Query Execution Issues

Symptoms

Warning dialog appears:
Ingrese una consulta SQL

Root Cause

Source: Controller.java:235-239The query text area (txtConsulta) is empty or contains only whitespace.

Solution

Enter a SQL query before clicking “Ejecutar”.
Double-click a table name in the “Tablas disponibles” list to auto-generate a SELECT query (SqlEditorView.java:146-156):
SELECT * FROM [table_name] LIMIT 100

Symptoms

Error dialog and system message:
Error en la consulta: You have an error in your SQL syntax...

Root Causes

Source: Model.java:101-154 - SQLException from Statement.executeQuery() or executeUpdate()
  1. Invalid SQL Syntax
    • Missing keywords (SELECT, FROM, WHERE, etc.)
    • Incorrect column/table names
    • Unmatched quotes or parentheses
  2. Reserved Keyword Usage
    • Using reserved words without backticks
    • Example: SELECT order FROM orders (should be `order`)
  3. Missing Semicolon (rare)
    • Some queries require explicit termination

Solutions

1

Verify Query Syntax

Check for common errors:
  • Missing FROM clause in SELECT
  • Missing WHERE column name
  • Unmatched quotes: 'value instead of 'value'
2

Test Query in MySQL CLI

mysql -h localhost -u [username] -p [database] -e "[your_query]"
3

Escape Reserved Keywords

Use backticks around reserved words:
SELECT `order`, `date`, `table` FROM `orders`;
The application does not perform client-side SQL validation. All syntax errors are caught when MySQL processes the query.

Symptoms

Error dialog:
Error en la consulta: Table 'database.tablename' doesn't exist
or
Error en la consulta: Unknown column 'column_name' in 'field list'

Root Causes

Source: SQLException from Statement.executeQuery() or executeUpdate()
  1. Typo in Name
    • Incorrect spelling of table or column
    • Wrong case (if database is case-sensitive)
  2. Wrong Database
    • Connected to different database than intended
    • Table exists but in another schema
  3. Table Dropped
    • Table was deleted after table list was populated
    • Table list needs refreshing

Solutions

1

Verify Database Connection

Check the connection status field at top right:
Conectado a: [database_name]
Ensure you’re connected to the correct database.
2

Refresh Table List

Click “Refrescar tablas” to update the table list (Controller.java:192-212).
3

Check Table Schema

Use DESCRIBE to verify table structure:
DESCRIBE table_name;
or
SHOW COLUMNS FROM table_name;

Symptoms

Query executes successfully but result table is empty.System message shows:
Consulta ejecutada correctamente

Root Causes

Not an error - This is normal behavior for:
  1. No Matching Rows
    • WHERE clause filters out all rows
    • Table is empty
  2. Successful Modification
    • INSERT/UPDATE/DELETE executed on empty table
    • Query affected 0 rows

Verification

1

Check Row Count

For modifications, the system message or result table will show:
Filas afectadas: 0
2

Verify Table Contents

Double-click the table in the “Tablas disponibles” list to generate:
SELECT * FROM [table] LIMIT 100
Then click “Ejecutar”.
3

Check WHERE Conditions

Remove or modify WHERE clause to see if rows exist:
SELECT * FROM users WHERE id = 999;  -- May return nothing
SELECT * FROM users;                 -- Returns all rows

Symptoms

Error dialog:
Error en la consulta: Duplicate entry '...' for key 'PRIMARY'
or
Error en la consulta: Cannot add or update a child row: a foreign key constraint fails

Root Causes

Source: SQLException from Statement.executeUpdate()
  1. Primary Key Violation
    • Attempting to insert duplicate primary key
    • Unique constraint violation
  2. Foreign Key Violation
    • Referencing non-existent parent row
    • Attempting to delete parent row with children
  3. NOT NULL Violation
    • Inserting NULL into NOT NULL column
    • Missing required columns in INSERT

Solutions

1

Check Existing Data

Before INSERT:
SELECT * FROM table WHERE id = [your_id];
2

Use INSERT IGNORE or REPLACE

Skip duplicates:
INSERT IGNORE INTO users (id, name) VALUES (1, 'John');
Replace existing:
REPLACE INTO users (id, name) VALUES (1, 'John');
3

Verify Foreign Key References

Check parent table exists:
SELECT * FROM parent_table WHERE id = [foreign_key_value];

Symptoms

Application appears frozen during query execution.UI is responsive but no results appear for a long time.

Root Causes

Source: Controller.java:242-264 - SwingWorker execution
  1. Large Result Set
    • SELECT without LIMIT on huge table
    • Returning millions of rows
  2. Missing Index
    • Query scans entire table without index
    • JOIN without proper indexing
  3. Expensive Operations
    • Complex calculations or aggregations
    • Large GROUP BY or ORDER BY operations

Solutions

1

Add LIMIT Clause

Restrict result size:
SELECT * FROM large_table LIMIT 1000;
The auto-generated query from double-clicking a table already includes LIMIT 100 (SqlEditorView.java:151).
2

Check Query Performance

Use EXPLAIN to analyze query:
EXPLAIN SELECT * FROM users WHERE email = '[email protected]';
Look for “type: ALL” which indicates full table scan.
3

Add Indexes

Create indexes on frequently queried columns:
CREATE INDEX idx_email ON users(email);
All queries execute asynchronously using SwingWorker (Controller.java:242-264). The UI remains responsive even during long queries, but results won’t appear until execution completes.

UI Responsiveness Issues

Symptoms

UI becomes unresponsive and cannot be interacted with.Buttons and text fields are grayed out.

Root Cause

Expected Behavior - View.bloquearInterfaz(true) is activeSource: View.java:239-252, Controller.java:110, Controller.java:150The interface is intentionally locked during async operations:
  • Database list loading
  • Database connection
  • Query execution
  • Table refresh

Normal vs. Problem

Normal:
  • Controls are grayed out
  • Operation completes within seconds
  • Interface unlocks automatically
Problem:
  • Operation takes very long time
  • Interface never unlocks
  • Application must be force-closed

Solutions

1

Wait for Operation to Complete

Check if this is a long-running query or slow network.The application will unlock automatically when the operation finishes.
2

Restart Application

If truly frozen:
  1. Force quit the application
  2. Check MySQL server status
  3. Verify network connectivity
  4. Restart the application
3

Check for Thread Deadlock

If issue persists, there may be a SwingWorker deadlock:
  • Check application logs
  • Verify no exceptions were swallowed
  • Ensure done() method is always called

Symptoms

After creating or dropping tables, the “Tablas disponibles” list doesn’t reflect changes.

Root Cause

Source: SqlEditorView.java:305-317 - List is not auto-refreshedThe table list is only updated:
  1. After initial connection (Controller.java:172-173)
  2. When “Refrescar tablas” is clicked (Controller.java:64)

Solution

Click the “Refrescar tablas” button to reload the table list (Controller.java:192-212).
Always refresh the table list after executing DDL statements (CREATE TABLE, DROP TABLE, ALTER TABLE).

Symptoms

Query executes successfully (system message shows success) but no results appear in table.

Root Causes

  1. Empty Result Set
    • Query returned 0 rows (see “Query Returns No Results” above)
  2. Modification Query
    • INSERT/UPDATE/DELETE shows affected row count instead of results
    • Source: Model.java:124, Model.java:147-148
  3. Previous Results Not Cleared
    • Old results still displayed from previous query

Solutions

1

Check System Message

Read the message above the results table:
  • “Consulta ejecutada correctamente” = Success
  • “Filas afectadas: N” = Modification query
  • “Error: …” = Query failed
2

Clear Previous Results

Click “Limpiar” to clear old results before executing new query (SqlEditorView.java:281-285).
3

Verify Query Type

For modification queries, the application attempts to display the affected table:Supported: Model.java:163-191
  • CREATE TABLE, INSERT INTO, UPDATE, DELETE FROM, TRUNCATE TABLE
Unsupported:
  • ALTER TABLE, DROP TABLE, CREATE INDEX, etc.
These show “Filas afectadas: N” instead.

Symptoms

Clicking “Cambiar BD” does nothing or shows error:
Error al desconectar: ...

Root Causes

Source: Controller.java:66-76, Controller.java:217-228
  1. Confirmation Cancelled
    • User clicked “No” on confirmation dialog
    • Expected behavior, not an error
  2. Connection Already Closed
    • Connection was terminated externally
    • SQLException during disconnect

Solutions

1

Confirm Disconnection

When prompted:
¿Desea desconectarse y cambiar de base de datos?
Click “Yes” to proceed.
2

Force Reconnect

If disconnect fails:
  1. Close the application
  2. Restart
  3. Login with new credentials/database

JDBC Driver Issues

Symptoms

Application fails to start or shows error:
ClassNotFoundException: com.mysql.jdbc.Driver
or
No suitable driver found for jdbc:mysql://...

Root Cause

Source: JDBC connection attempts in Model.java:30, Model.java:54-58MySQL Connector/J JAR is missing from classpath.

Solutions

1

Download MySQL Connector/J

Get the latest JDBC driver from:
https://dev.mysql.com/downloads/connector/j/
Download the Platform Independent ZIP.
2

Add to Classpath

Command Line:
java -cp ".:mysql-connector-j-8.0.33.jar" -jar mysql-editor.jar
IDE (Eclipse/IntelliJ):
  1. Right-click project → Properties/Settings
  2. Add External JARs
  3. Select mysql-connector-j-x.x.x.jar
  4. Rebuild project
3

Verify Driver Loading

Test with minimal code:
try {
    Class.forName("com.mysql.cj.jdbc.Driver");
    System.out.println("Driver loaded successfully");
} catch (ClassNotFoundException e) {
    System.err.println("Driver not found: " + e.getMessage());
}
Modern MySQL Connector/J (8.0+) uses com.mysql.cj.jdbc.Driver instead of com.mysql.jdbc.Driver. The application relies on automatic driver loading via JDBC 4.0, so no explicit Class.forName() is needed.

Symptoms

Warnings in console:
Loading class 'com.mysql.jdbc.Driver'. This is deprecated.
or
Public Key Retrieval is not allowed

Root Causes

  1. Old Driver with New MySQL
    • MySQL Connector/J 5.x with MySQL 8.0
    • Deprecated driver class
  2. Authentication Plugin Mismatch
    • MySQL 8.0 uses caching_sha2_password
    • Old drivers don’t support this

Solutions

1

Update MySQL Connector/J

Use MySQL Connector/J 8.0.33 or later:
https://dev.mysql.com/downloads/connector/j/8.0.html
2

Update Connection String (if needed)

Add authentication parameters to Model.java:
String url = "jdbc:mysql://" + host + ":3306/" + database 
           + "?useSSL=false&allowPublicKeyRetrieval=true";
3

Change MySQL Authentication Plugin

If updating driver is not possible:
ALTER USER 'username'@'localhost' 
IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;

Error Message Reference

Login View Errors

Error MessageSourceCauseSolution
”El usuario es requerido”Controller.java:86Empty username fieldEnter username
”La contraseña es requerida”Controller.java:91Empty password fieldEnter password
”Debe seleccionar una base de datos”Controller.java:96No database selectedSelect from dropdown or click Actualizar
”No se encontraron bases de datos”Controller.java:129No user databases existCreate a database in MySQL
”Error: Controller.java:137, Controller.java:180Connection/query failedCheck MySQL server, credentials, network
”Error de conexión: Controller.java:180Connection failedVerify server is running, credentials are correct

Editor View Errors

Error MessageSourceCauseSolution
”Ingrese una consulta SQL”Controller.java:236-238Empty queryEnter SQL query
”Error en la consulta: Controller.java:257-258SQL errorCheck syntax, table names, permissions
”Error al obtener tablas: Controller.java:205-207Table list refresh failedCheck connection, database still exists
”Error al desconectar: Controller.java:224-226Disconnect failedForce quit and restart
”Consulta ejecutada correctamente”Controller.java:253Query succeededNormal success message
”Filas afectadas: Model.java:148Modification queryShows number of affected rows

Getting Additional Help

Check MySQL Logs

MySQL error logs contain detailed information about connection issues and query errors.Log Locations:
  • Linux: /var/log/mysql/error.log
  • Windows: C:\ProgramData\MySQL\MySQL Server 8.0\Data\*.err
  • macOS: /usr/local/mysql/data/*.err
View Recent Errors:
sudo tail -f /var/log/mysql/error.log

Enable JDBC Logging

Add logging to connection URLs in Model.java for debugging:
String url = "jdbc:mysql://" + host + ":3306/" + database 
           + "?useSSL=false&logger=com.mysql.cj.log.StandardLogger"
           + "&profileSQL=true";

Test with MySQL CLI

Always test problematic queries in the MySQL command-line client first:
mysql -h localhost -u username -p database_name
If the query fails in CLI, it’s a MySQL issue, not an application issue.
Most issues stem from MySQL configuration, credentials, or network connectivity rather than the application itself. Always verify external dependencies first.

Build docs developers (and LLMs) love