-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFakebookOracle.java
More file actions
executable file
·87 lines (66 loc) · 1.97 KB
/
Copy pathTestFakebookOracle.java
File metadata and controls
executable file
·87 lines (66 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package project2;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class TestFakebookOracle {
static String dataType = "PUBLIC";
static String oracleUserName = ""; //replace with your Oracle account name
static String password = ""; //replace with your Oracle password
public static void main(String[] args) {
try {
Connection conn = getConnection();
FakebookOracle fbwz = new MyFakebookOracle(dataType, conn);
OutputStreamWriter out = new OutputStreamWriter(System.out);
// Query 0
fbwz.findMonthOfBirthInfo();
fbwz.printMonthOfBirthInfo(out);
// Query 1
fbwz.findNameInfo();
fbwz.printNameInfo(out);
// Query 2
fbwz.popularFriends();
fbwz.printPopularFriends(out);
// Query 3
fbwz.liveAtHome();
fbwz.printLiveAtHome(out);
// Query 4
fbwz.findPhotosWithMostTags(5);
fbwz.printPhotosWithMostTags(out);
// Query 5
fbwz.matchMaker(5,2);
fbwz.printBestMatches(out);
// Query 6
fbwz.suggestFriendsByMutualFriends(5);
fbwz.printMutualFriendsInfo(out);
// Query 7
fbwz.findAgeInfo(215L);
fbwz.printAgeInfo(out);
// Query 8
fbwz.findEventCities();
fbwz.printCityNames(out);
// Query 9
fbwz.findPotentialSiblings();
fbwz.printPotentialSiblings(out);
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
public static Connection getConnection() throws SQLException{
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
} catch (InstantiationException e1) {
e1.printStackTrace();
} catch (IllegalAccessException e1) {
e1.printStackTrace();
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
return DriverManager.getConnection("jdbc:oracle:thin:@forktail.dsc.umich.edu:1521:COURSEDB", oracleUserName, password);
}
}