The connection is only establishable in linux1.cse.cuhk.edu.hk
- Copy whole file to cse machine
scp -r javaSQL/ {CSE USERNAME}@gw.cse.cuhk.edu.hk:{DIRECTORY}
- Modify
JavaSQL.java
String url = "jdbc:mysql://appsrvdb.cse.cuhk.edu.hk/CSCI3170S10";
String username = "CSCI3170S10";
String password = "csci3170Project!";
// With equal port number and password in above
-
make
-
Run Java application
java -cp .:jdbc.jar JavaSQL
Using Docker and create own MySQL server for testing
- Install Docker
- Pull Docker image
docker pull centurylink/mysql
- Run Docker and create container
docker run -d -v {LOCAL DIR}:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=test centurylink/mysql
# Port number = 3306
# username = root, password = test
# {LOCAL DIR}: To store mysql database permanent
# By mounting local directory to docker volume
OR
bash javaSQL/hostMySQL.sh
# By default, localhost:3306 , username = root , password = test
# Need to create mysql/ in Desktop
To kill container after testing, check container ID by docker container ls
Then, kill container docker stop ${CONTAINER_ID}
- Modify
JavaSQL.java
String url = "jdbc:mysql://localhost:3306";
String username = "root";
String password = "test";
// With equal port number and password in above
make
java -cp .:jdbc.jar JavaSQL
-
Operations for administrator menu
- 1.1 Create all tables
- 1.2 Delete all tables
- 1.3 Load Data
- 1.4 Show number of records in each table
- 1.5 Return to the main menu
-
Operations for library user menu
- 2.1 Search for books
- 2.2 Show checkout records of a user
- 2.3 Return to the main menu
-
Operations for librarian menu
- 3.1 Book Borrowing
- 3.2 Book Returning
- 3.3 List all un-returned book copies which are checked out within a period
- 3.4 Return to the main menu