Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void ispisiPodatke(String file) {
- BP_Konfiguracija obj = null;
- try {
- obj = new BP_Konfiguracija(file);
- } catch (NoPropertiesException ex) {
- Logger.getLogger(Vjezba_06_2.class.getName()).log(Level.SEVERE, null, ex);
- }
- String host = obj.getServerDatabase();
- String username = obj.getUserUsername();
- String password = obj.getUserPassword();
- host = "jdbc:mysql://localhost:3306/nwtis_g1";
- try (Connection con = DriverManager.getConnection(host, username, password)){
- Statement stmt = con.createStatement();
- String sql = "SELECT * FROM polaznici";
- ResultSet rs = stmt.executeQuery(sql);
- while(rs.next()){
- System.out.print(rs.getString("ime") + " ");
- System.out.print(rs.getString("prezime"));
- System.out.println();
- }
- } catch (SQLException ex) {
- Logger.getLogger(Vjezba_06_2.class.getName()).log(Level.SEVERE, null, ex);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement