I have no idea how to handel things with SQL in Java, but I do know this MySQL query returns the column names it's:
"SHOW FIELDS FROM table_name" this is just like an SELECT query.
I hope this helps, for more infomation see: Mysql
I like Java!
Java is cool!