- Load the Database from ticketreservation repository.
- Clone the repository.
- Type
sudo -s -u postgres
in terminal. - Type
psql
in terminal. - Load the database by the command
\i setup.sql
- Create a file database.properties in the directory(Containing ServiceModule.java) with the following contents. Put the user, password and db_url of your own database.
JDBC_DRIVER=org.postgresql.Driver
USER=postgres
PASS=1234
DB_URL=jdbc:postgresql://localhost:5432/railways
- Compile the Following files using javac
- sendQuery.java
- invokeWorkers.java
- client.java
- ServiceModule.java
- Interactor.java
- Open a terminal and run ServiceModule file by typing
java ServiceModule
- Now the server has started to take query
- Store the input files in the Input folder
- Open another terminal and run client file by typing
java client
- Check the output in the output folder
- each line of the file should follow format mentioned below:
- "Number of passengers" "passenger names seperated by comma" "train number" "date" "coach type"
-
line 1: <Train-No> line 2: <Train-Name>
-
<Train-No> <date of journey> <no:of Ac-coaches> <no:of sleeper-coaches> # (At the end)
-
<Station-Name>:<Station-Code>
-
line 1: <Train-Number> line 2: <Number-of-Stations-in-Path> // For each station in order as seen by train, enter following details, <Station-Code> <Day-of-arrival> <Time-of-arrival> <Day-of-Departure> <Time-of-Departure>
- How to Run?
Javac Interactor.java
Java Interactor