Databases at the CS-department


Database environments

Two of departments servers bodbacka.cs.helsinki.fi and users.cs.helsinki.fi are dedicated for use as database servers for student projects. Bodbacka server runs the Oracle databases (Oracle 11.2.0) and users.cs.helsinki.fi runs the postsgreSQL databases. Both database environments are centrally managed. to the top

Oracle instructions

Oracle accounts

You need an Oracle account to be able to use the Oracle database. When you have the account you are able to create your own tables and access these tables. To create a user account, go to the Oracle account management page. To enter the page you must provide your CS departments main account name and password. You may use this page also to change the password, even if you have forgotten your current one. The account name in Oracle will be the same as your account name.

Alkuun

Using Oracle

A relational database is operated with SQL commands and scripts. These sripts and command can be used in the Application project, for example, to create tables and to enter and query test data.

Setup

To execute SQL commands and scripts you need an SQL-client software. Users.cs.helsinki.fi provides a textual interface (sqlplus. To start the program you must set up some environment variables. Use the command setup oracle to do that.

Alkuun

Textual interface

The textual interface (sqlplus) is started with the command sqlplus /nolog. The prompt changes to 'sql>'. A database session is then started using the connect-command:

"connect <USER>/<PASSWORD>@bodbacka/test".

Replace <USER> and <PASSWORD> with your Oracle account name and password, for example, a session on database test as user scott (password tiger) is started as"connect scott/tiger@bodbacka/test".

Some useful commands in the textual interface are listed below.

The queries or query scripts may also be made externally outside the textual interface. A file that contains a sequence of sql commands may be executed using the command start filename.sql or @ filename.sql. Each command in the sequence must end with a semicolon or forward slash as a separate line, for example:

   insert into table1 values(1,2);
   insert into table1 values(2,3);
   commit;

or

   insert into table1 values(1,2)
   /
   insert into table1 values(2,3)
   /
   commit
   /
You should keep in mind that update, insert and delete operations need to be committed to take effect.

Alkuun

Graphical interface

The graphical TOra database tool is started with the command /opt/tora/bin/tora. You must enter your Oracle account name and password, schema name = account name, and the database name (bodbacka.test) to connect to the database.

To the top

Oracle in servlets

Oracle-manuals

Some Oracle manuals in pdf-format (about 2-10M each):

Alkuun

PostgreSQL instructions

Setup

There is a script wanna-postgres to make an account on the postgreSQL database. This script is available only on users.cs.helsinki.fi.

Alkuun

Using Postgre

Porsgres provides a textual interface psql.

Alkuun

PostgreSQL in servlets

Postgres may be used in servlets and in php. The driver needed for database connections is /usr/local/pgsql-7.4/jdbc.jar. The name of the driver class is org.postgresql.Driver. Connection data needed in establihing database connections is jdbc:postgresql://localhost/username. Alkuun

PostgreSQL manuals

Alkuun

Harri Laine 3.1.2011,