import java.sql.*; import javax.swing.*; import java.awt.*; public class Tableau { public static void main(String[] args) { try { Class.forName("org.mariadb.jdbc.Driver"); } catch (ClassNotFoundException ex) { System.err.println("MariaDB driver not found"); return; } Connection cnx; try { cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/horville", "horville", "a5gc95"); } catch (SQLException ex) { System.err.println("Unable to access Database."); return; } try { PreparedStatement req = cnx.prepareStatement("SELECT Module.code, Champ.code FROM Champ JOIN Module ON Champ.id = Module.id ORDER BY Module.code ASC;"); req.executeUpdate(); ResultSet rs = req.executeQuery(); while (rs.next()) { System.out.println(rs.getString(1) + " " + rs.getString(2)); } rs.close(); req.close(); } catch (SQLException ex) { System.err.println("SQL Request exception."); System.err.println (ex); } try { cnx.close(); } catch (SQLException ex) { System.err.println("Unable to close connection."); } } }