Guest User

Untitled

a guest
May 6th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. download.setOnAction(e -> {
  2.  
  3. String userName = "name";
  4. String password = "pass";
  5. String connectionURL = "jdbc:mysql://f0203515.xsph.ru:3306/f0205517_apps?useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
  6.  
  7. try {
  8. DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
  9. } catch (SQLException e1) {
  10. window.close();
  11. }
  12. try (Connection connection = DriverManager.getConnection(connectionURL,userName,password);
  13. Statement statement = connection.createStatement()){
  14. ResultSet resultSet = statement.executeQuery("SELECT * FROM links");
  15. while (resultSet.next()){
  16. //да, говнокод. Но рабочий. Перепилю когда исправлю косяк.
  17. img[0] = resultSet.getString("link1");
  18. centerTextField.setText(img[0]);
  19. centerMenu.getChildren().addAll(centerTextField);
  20. }
  21.  
  22. } catch (SQLException e1) {
  23. window.close();
  24. }
  25. });
Add Comment
Please, Sign In to add comment