Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.sql.*;
- import java.lang.String;
- public class Database {
- public static void main(String args[]){
- String id, permission = null;
- int izbor;
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Enter you ID number.");
- id = keyboard.nextLine();
- ////////////////////////////////////////////////////////////////////////////////////
- try{
- Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/java-15", "root", "");
- Statement myStatement = myConn.createStatement();
- ResultSet Rs = myStatement.executeQuery("SELECT * FROM zaposlenici WHERE id =" +id);
- while (Rs.next()){
- permission = Rs.getString("razina_prava");
- }
- }catch (Exception exc){
- exc.printStackTrace();
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- }
- }
- public String userInputTableSwitch(int userInput) {
- String statement = null;
- switch(userInput){
- case 1: /*do stuff here*/ return statement;
- case 2: /*do stuff here*/ return statement;
- case 3: /*do stuff here*/ return statement;
- default: /*make a default*/ return statement;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement