import java.sql.*; import javax.swing.*; public class appl_01 { public static void main(String[] args) throws Exception { String url = "jdbc:mysql://aragorn.elo.utfsm.cl/arg_musiteca"; String login = "antares"; String pass = ""; Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(url,login,pass); if (conn != null) { Statement stmt = conn.createStatement(); String sql = "show tables"; ResultSet rs = stmt.executeQuery(sql); System.out.println("Tablas"); System.out.println("------"); while (rs.next()) { String r = rs.getString(1); System.out.println(r); } conn.close(); } } catch(SQLException ex) { JOptionPane.showMessageDialog(null, ex); } catch(ClassNotFoundException ex) { JOptionPane.showMessageDialog(null, ex); } } }