bonjour, je souhaite que l'utilisateur entre le nom d'un chanteur et mon programme et censé lui retourné la liste de ces album.
voici mon code :
la requete ne fonctionne pas. merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public static void main(String[] args) throws SQLException { try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException ex) { ex.printStackTrace(); // TODO code application logic here } String n ; Connection con= DriverManager.getConnection("jdbc:postgresql://localhost/*","",""); System.out.println("connexion reussi"); Scanner clavier = new Scanner(System.in); System.out.println("Entrer un artiste:"); n = clavier.nextLine(); String sql =("select titre from cd where artiste like '+n'") ; Statement pst = con.createStatement(); ResultSet rset = pst.executeQuery(sql); while (rset.next ()){ System.out.println(rset.getString ("titre"));
Partager