Active Connection Display
The current connection status is displayed in the SQL Editor’s connection panel:Connected State
Shows “Conectado a: [database_name]” when actively connected to a database.
Disconnected State
Shows “Estado: No conectado” when no active connection exists.
Connection Status Field
The connection status is displayed in a non-editable text field:The status field uses a light blue background (#E6F0FF) to distinguish it from editable components and provides tooltip information on hover.
Switching Databases
To change to a different database, use the Cambiar BD (Change Database) button:Confirmation Dialog
Click Cambiar BD Button
Click the Cambiar BD button in the SQL Editor interface. This button is located in the right panel near the connection status.
Confirm Disconnection
A confirmation dialog appears asking: “¿Desea desconectarse y cambiar de base de datos?” (Do you want to disconnect and change database?)Choose:
- Yes: Proceed with disconnection
- No: Cancel and maintain current connection
Disconnecting from Database
The disconnection process closes the MySQL connection properly:What Happens During Disconnection
Connection Cleanup
Connection Cleanup
The JDBC connection is properly closed:This releases database resources and terminates the session.
UI State Reset
UI State Reset
The editor view is reset to disconnected state:
View Switching
View Switching
The SQL Editor closes and login view reopens:
Error Handling
If disconnection fails, an error dialog displays the specific SQL error message. This is rare but can occur if the connection is already closed or network issues exist.
Refreshing Table Listings
The Refrescar tablas (Refresh Tables) button updates the list of available tables:Refresh Process
When to Refresh Tables
After Creating Tables
Refresh to see newly created tables in the browser:Then click Refrescar tablas.
After Dropping Tables
Refresh to remove deleted tables from the list:Then click Refrescar tablas.
External Changes
If another application or user modifies the database schema, refresh to see the changes.
Verify Structure
Periodically refresh to ensure your view matches the actual database structure.
Fetching Table Metadata
TheobtenerTablasDeBaseDatos() method retrieves the current table list:
The method uses JDBC
DatabaseMetaData to retrieve only tables (not views or system tables) from the current catalog.Metadata Parameters
- Catalog: Current database name
- Schema Pattern:
null(all schemas) - Table Name Pattern:
"%"(all tables) - Types:
["TABLE"](only regular tables)
Error Handling for Refresh
- Connection lost or timed out
- Insufficient permissions to view metadata
- Database server unreachable
Table List Display
The table browser shows all available tables:Interactive Features
Double-Click Generation
Double-Click Generation
Double-clicking a table name generates a SELECT query:
Tooltip Information
Tooltip Information
Hovering over the table list shows context:
Empty State
Empty State
When no tables exist:
Connection State Management
The application maintains connection state throughout the session:Initialization on Connect
- Database name is set in the status field
- Tables are automatically fetched
- Table browser is populated
- SQL Editor window opens
Connection Persistence
The connection remains active until:- You click Cambiar BD and confirm
- The application exits
- A connection error occurs
- The database server closes the connection
Background Processing
All connection operations useSwingWorker for non-blocking execution:
Background processing ensures the UI remains responsive during network operations and database queries.
Best Practices
Save Queries Before Switching
Copy important queries to an external file before changing databases to avoid losing work.
Refresh After Schema Changes
Always refresh the table list after executing DDL statements (CREATE, ALTER, DROP).
Verify Connection Status
Check the connection status field before executing queries to ensure you’re connected to the correct database.
Use Confirmation Dialogs
Read confirmation dialogs carefully before switching databases to prevent accidental disconnections.
Next Steps
Connecting to MySQL
Learn the initial connection process
Writing Queries
Master SQL query writing and execution
Viewing Results
Understand how to interpret query results