Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Scanner scan = new Scanner(System.in);
- public static DecimalFormat DecimalFormat = new DecimalFormat("#.##");
- private static final String USERNAME = "rocoblanatot";
- private static final String PASSWORD = "Rogojan19881988";
- private static final String CONN_STRING = "jdbc:mysql://localhost:3306/newscheme";
- public static int Index = 0;
- public static Connection connect;
- public ResultSet result;
- public static void main(String args[]) throws Exception {
- Class.forName("com.mysql.jdbc.Driver");
- connect = DriverManager.getConnection(CONN_STRING, USERNAME, PASSWORD);
- System.out.println("Connected");
- get();
- }
- public static ArrayList<String> get() throws Exception{
- try {
- PreparedStatement statement = connect.prepareStatement("SELECT YY,DD from book");
- ResultSet result = statement.executeQuery("SELECT * from book");
- ArrayList<String> array = new ArrayList<String>();
- ArrayList<Integer> score1 = new ArrayList<Integer>();
- ArrayList<Integer> score2 = new ArrayList<Integer>();
- while(result.next()) {
- //System.out.print(result.getString("YY")+"."+result.getString("MM")+"."+result.getString("DD")+
- // " "+result.getString("Team1")+" "+result.getString("Team2") );
- //System.out.println((" "));
- array.add(result.getString("YY")+"."+result.getString("MM")+"."+result.getString("DD")+
- " "+result.getString("Team1")+" "+result.getString("Team2"));
- score1.add(result.getInt("Final Team1"));
- score2.add(result.getInt("Final Team2"));
- }
- for (String list: array) {
- if(list.contains("Manchester")) {
- Index = array.indexOf(list);
- System.out.println(list + " " + score1.get(Index) +"-"+ score2.get(Index) );
- }
- }
- return array;
- }catch(Exception e) {System.out.println(e);}
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement