I’m having trouble with column aliases in Oracle SQL Developer. I’m connected to a MariaDB database using a MySQL JDBC driver. When I run a query with aliases, the result shows the original column names instead of the aliases.
Here’s a simple example:
CREATE TABLE staff (
full_name VARCHAR(50),
contact VARCHAR(15),
years_old INT,
region CHAR(2)
);
INSERT INTO staff VALUES
('John Doe', '555-1234', 35, 'NY'),
('Jane Smith', '555-5678', 28, 'CA');
SELECT full_name, contact, years_old AS age, region AS location FROM staff;
The output shows the original column names, not the aliases ‘age’ and ‘location’. However, if I use functions like CAST, the aliases work fine.
I’ve tried different alias syntaxes (AS, quotes, backticks) but nothing helps. Interestingly, the aliases work correctly when I connect directly to MariaDB via command line.
Any ideas why this is happening with my SQL Developer setup? Is it a config issue between SQL Developer, MySQL JDBC, and MariaDB?
hmm, interesting issue! have u tried using derived columns instead of aliases? like SELECT full_name, contact, years_old age, region location FROM staff
? Sometimes that works better with weird driver combos. Also, what version of SQL Developer r u using? Might be worth checking for any known bugs?
hav u tried updating ur SQL Developer? sometimes older versions hav quirks with different DBs. also, check ur JDBC driver version - might need an update too. if those don’t work, maybe try a different client like DBeaver? it’s pretty good with MariaDB
This issue seems to be specific to the interaction between Oracle SQL Developer and MariaDB via the MySQL JDBC driver. It’s likely a compatibility problem or a bug in how SQL Developer interprets the result set metadata from MariaDB.
As a workaround, you could try using derived tables or subqueries to force SQL Developer to recognize the aliases. For example:
SELECT * FROM (
SELECT full_name, contact, years_old AS age, region AS location
FROM staff
) subquery;
This often tricks the client into displaying the aliases correctly. If this doesn’t work, you might want to consider using a different SQL client that’s more compatible with MariaDB, such as DBeaver or HeidiSQL. Alternatively, you could report this as a bug to Oracle Support for SQL Developer, as it should ideally handle aliases correctly regardless of the underlying database system.