Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. package app.database.driver;
  2. import java.sql.*;
  3. /**
  4. *
  5. * @author notebook
  6. */
  7. public abstract class SqlDriver {
  8. protected Connection connection;
  9. protected PreparedStatement preparedStatement;
  10. protected static final String URL = "jdbc:postgresql://slon.felk.cvut.cz:5432/db17_perinma2", USER = "db17_perinma2", PASSWORD = "db17_perinma2";
  11.  
  12. protected boolean openConnection(){
  13. try{
  14. Class.forName("org.postgresql.Driver");
  15. connection = DriverManager.getConnection(URL, USER, PASSWORD);
  16. return true;
  17. }
  18. catch(Exception e){
  19. return false;
  20. }
  21. }
  22. protected void closeConnection() throws SQLException{
  23. connection.close();
  24. }
  25. public abstract void ExecuteQuery(String sqlstatement);
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement