Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 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. }finally {
  24.  
  25. }
  26.  
  27. }
  28. public Connection getConnection() {
  29. return connection;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement