Advertisement
Guest User

Untitled

a guest
Dec 21st, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.sql.*;
  3. import java.lang.String;
  4.  
  5. public class Database {
  6. public static void main(String args[]){
  7.  
  8. String id, permission = null;
  9. int izbor;
  10. Scanner keyboard = new Scanner(System.in);
  11.  
  12. System.out.println("Enter you ID number.");
  13. id = keyboard.nextLine();
  14.  
  15. ////////////////////////////////////////////////////////////////////////////////////
  16. try{
  17. Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/java-15", "root", "");
  18. Statement myStatement = myConn.createStatement();
  19. ResultSet Rs = myStatement.executeQuery("SELECT * FROM zaposlenici WHERE id =" +id);
  20. while (Rs.next()){
  21. permission = Rs.getString("razina_prava");
  22. }
  23.  
  24. }catch (Exception exc){
  25. exc.printStackTrace();
  26. }
  27. ////////////////////////////////////////////////////////////////////////////////////////////////////
  28. }
  29. }
  30.  
  31. public String userInputTableSwitch(int userInput) {
  32.  
  33. String statement = null;
  34.  
  35. switch(userInput){
  36. case 1: /*do stuff here*/ return statement;
  37. case 2: /*do stuff here*/ return statement;
  38. case 3: /*do stuff here*/ return statement;
  39. default: /*make a default*/ return statement;
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement