Advertisement
Guest User

Psartek

a guest
Dec 5th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. package activeRecord;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6. import java.util.Properties;
  7.  
  8. public class DBConnection {
  9. private static DBConnection db;
  10. private Connection conn;
  11.  
  12. private static String password="";
  13. private static String user="root";
  14. private static String server="localhost";
  15. private static String dbname="test";
  16. private static String port="3306";
  17.  
  18.  
  19. public static synchronized DBConnection getInstance(){
  20. if(db == null){
  21. db = new DBConnection();
  22. }
  23. return db;
  24. }
  25.  
  26. public static Connection getConnection(){
  27. //try {
  28. return DBConnection.getInstance().conn;
  29. //} catch (SQLException e){
  30.  
  31. //}
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement