Advertisement
Guest User

Untitled

a guest
Jan 30th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args){
  5.  
  6. Scanner in = new Scanner(System.in);
  7.  
  8. String username;
  9. String password;
  10.  
  11. System.out.println("");
  12. System.out.println("Username: ");
  13. username = in.next();
  14. System.out.println("Password: ");
  15. password = in.next();
  16.  
  17.  
  18.  
  19. in.close();
  20. }
  21. }
  22.  
  23. import java.sql.DriverManager;
  24. import java.sql.Connection;
  25. import java.sql.SQLException;
  26.  
  27. public class main {
  28. public static void main(String args[]) {
  29. try {
  30. Class.forName("com.mysql.jdbc.Driver");
  31. Connection conn = null;
  32. conn = DriverManager.getConnection("jdbc:mysql://localhost/test","root", "");
  33. System.out.println("Database is connected !");
  34. conn.close();
  35. }
  36. catch(Exception e){
  37. System.out.println("Do not connect to DB - Error:"+e);
  38. }
  39. System.out.println("Hello ppl");
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement