Advertisement
Scion_aku

farhad002

Jul 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. package postgreSQL;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.PreparedStatement;
  6. import java.sql.ResultSet;
  7. import java.sql.ResultSetMetaData;
  8. import java.sql.SQLException;
  9. import java.sql.Statement;
  10. import java.util.Scanner;
  11.  
  12. /**
  13. *
  14. * @author Science Fidelity
  15. */
  16. public class PostGreConnection {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21. public static void main(String[] args) {
  22.  
  23. Update update = new Update();
  24. Delete remove = new Delete();
  25. Insert insert = new Insert();
  26.  
  27. String dbURL = "jdbc:postgresql://localhost:5432/postgres";
  28. String dbUser ="postgres";
  29. String dbPass ="1234";
  30.  
  31. String insertId;
  32. String insertName;
  33. String UpdateId;
  34. String UpdateName;
  35. String DeleteId;
  36. Scanner sc = new Scanner(System.in);
  37. System.out.println("Enter a ID (Insert)");
  38. insertId = sc.nextLine();
  39. System.out.println("Enter a Name (Insert)");
  40. insertName = sc.nextLine();
  41. System.out.println("Enter a ID (Update)");
  42. UpdateId = sc.nextLine();
  43. System.out.println("Enter a Name (Update)");
  44. UpdateName = sc.nextLine();
  45. System.out.println("Enter a Id (Delete)");
  46. DeleteId = sc.nextLine();
  47.  
  48. insert.InsertTeacher(dbURL,dbUser,dbPass,insertName,insertId);
  49. update.updateTeacher(dbURL,dbUser,dbPass,UpdateName,UpdateId);
  50. remove.DeleteTeacher(dbURL,dbUser,dbPass,DeleteId);
  51.  
  52.  
  53.  
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement