Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. package com.romanko.olga;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6.  
  7. /**
  8. * Created by DELL on 03.12.2016.
  9. */
  10. public class DBConnector {
  11. private final String HOST = "jdbc:mysql://localhost:3306/flatdb";
  12. private final String USERNAME = "root";
  13. private final String PASSWORD = "root";
  14.  
  15. private Connection connection;
  16.  
  17. public DBConnector() {
  18.  
  19. try {
  20. connection = DriverManager.getConnection(HOST, USERNAME, PASSWORD);
  21. } catch (SQLException e) {
  22. System.out.printf("Driver not found");
  23. }
  24.  
  25.  
  26. }
  27. public Connection getConnection() {
  28. return connection;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement