Skip to content

Project for the course CS2102: Introduction to Database Systems at NUS, Autumn 2010

License

pascalc/database_project

Repository files navigation

SETTING UP THE DATABASE
The database we are using is mysql-client-5.1 and mysql-server-5.1 plus that it might be some other packages installed to support these two.

After, if needed, installing mysql type 'mysql -u root' (in the command line if using linux) to enter mysql as root user.
When logged in, create a new database called 'dbproject' in the following way 'mysql> create database dbproject;'. After creating the database it is time to set up a user, for sake of simplicity, called 'dbproject' with password 'dbproject'. It is similiar to above, namely 'mysql> create user dbproject;'. 

When that is set up, it is time to grant access to user 'dbproject' to access database 'dbproject'. It is done in the following way:
'mysql> GRANT ACCESS TO dbproject.* TO dbproject@localhost;'. That gives the user the privilege to alter with the tables in dbproject.

After all that is then, type 'myslq> quit' and login in as user 'dbproject' '>myslq -u dbproject -p' and then type in the password. Now it is time to create the tables that we are using. A sql file with the tables is already set up so typ 'mysql>quit' and then when in the shell type:
'>mysql -u dbproject -p < path/to/database_project/db/ddl.sql' and that loads everything into the database. path/to/ should of course be replaced with the path to the actual file on your computer. For example home/docs/school/cs2102/database_project/db/ddl.sql

POPULATING THE DATABASE
Now it is a simple matter of populating the database with some dummy data. To do that, just use the file 'seed.rb' provided in database_project/ and it will populate the database with random data.

REQUIRMENTS
This webpage is running on ruby1.8 or ruby1.9 together with sinatra1.1 and sequel. Manuals to install those on Linux and Windows is found on internet. Might wanna take a look at rvm for ruby as well.

LOADING THE WEBPAGE
Just type '>ruby app.rb' and the following should be displayed 
'> == Sinatra/1.1.0 has taken the stage on 4567 for development with backup from WEBrick
> [2010-10-30 15:38:52] INFO  WEBrick 1.3.1
> [2010-10-30 15:38:52] INFO  ruby 1.9.0 (2008-10-04) [i486-linux]
> [2010-10-30 15:38:57] INFO  WEBrick::HTTPServer#start: pid=6410 port=4567' <===

Notice the port number and then type localhost:port_number (in our case localhost:4567) into the browser filed and the page should come up!



About

Project for the course CS2102: Introduction to Database Systems at NUS, Autumn 2010

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages