02170 Database Systems, Spring 2006

Mainpage Course Plan E-bar Software Web Docs Project

E-bar.

Students attending this course have access to

Assistant Teacher

The assistant teacher is no longer available.

The teacher (Hans Bruun) will be available at his office (building 325, room 211) every Tuesday (except 16/5) and Thursday after 10:00 and will visit the e-bar  every Thursday between 10:00 and 12:00.

Software

 

Relational Databases

PostgreSQL-clients

In the e-bar you have access to the PostgreSQL server at csdbs.imm.dtu.dk.
The PostgreSQL system provides two clients that can be used to get access to the database, a simple command based client psql and pgAdmin3 with a graphical user interface. Both are located in ....\PostgreSQL\8.1\bin. To get access you must have  a database username and a password. Your username will be one of grp1, grp2, grp3, etc. You will have access to one database with the same name as your username. You can get your username and password from the assistant teacher (or teacher).

 

psql

To get connection to your postgreSQL database using psql call psql in a DOS window:

psql -U user -h csdbs.imm.dtu.dk   database

If you don't have psql.exe in your path you must specify the full path ...\postgresql\8.1\bin\psql.

So if your username is grp12 you will have to write like this

psql -U grp12 -h csdbs.imm.dtu.dk   grp12

The authentication will only allow you to access the database from terminals in the e-bar. If you get connected the system will then prompt you for your password.

 

pgAdmin3

Start pgAdmin3 from the Programs-menu and choose file/Add Server:

After connection, in the left window (double) click Databases to see all databases and then select your database (grp12). Now Tools/Query Tool gives you a window where you can execute sql.

Read the help to get familiar with psAdmin3.

 

psql in XEmacs

The emacs editor xemacs has an SQL-mode that makes it easy to write SQL and send it to the database server. You need to install a modified SQL-mode (sql.el, sql.elc) that is available in the courses campusnet webpage under file-sharing or from here: (sql.el) if you are in the data-bar.

You will have to do the following steps:

Now, when you in xemacs open an sql-file, xemacs will enter sql-mode using the new sql.el file. Now continue as described in the next section.

Using the database server from inside Xemacs

Xemacs must be in sql-mode (i.e. you must be editing an sql-file). In xemacs execute the command sql-postgres (type alt-X, and then in the minibuffer type sql-postgres <enter>). You will now be prompted for the user-name (like grp12) server-name (csbase2.it.dtu.dk) and database-name (like grp12) and finally the database server in a new window will ask you for the password. If accepted you will now have an xemacs window looking like this:

You have the sql-file (xxx.sql) in the first buffer and the psql prompt in the second (*SQL*) buffer.

Next you must associate the xxx.sql buffer with the *SQL* buffer. Place the curser in the xxx.sql buffer. From the SQL-menu choose SetSQLibuffer and then as a response to the question in the mini-buffer type <enter>.
 

Now,  when you edit your sql you can send all or part of the sql to the server as follows:

the paragraph where the cursor is: C-c C-c
the region (the selected part of the buffer): C-c C-r
the whole buffer: C-c C-b

The response from the server will appear in the *SQL*-buffer.

 

JDBC

Notice that the postgresql JDBC driver is in the postgreSQL installation directory in the jdbc subdirectory: postgresql-8.1-404.jdbc3.jar

You must have this jar file in your class path when you run your JDBC-based Java program.
So you can e.g. run your java program with a command like this

    java -cp ".;c:\.....\jdbc\postgresql-8.1-404.jdbc3.jar" myprogram

if you are in the directory containing your program.

 

ER-Diagrams

To draw ER-diagrams you can use MS-visio.

 

XML-Databases

XRay2 XML-editor

A simple XML-editor, but it can also validate against a DTD or XML-Schema.

 

IPSI-XQ, The XQuery Demonstrator:

        http://www.ipsi.fraunhofer.de/i-info/en/content/view/74/0//download_e.html

 

jEdit as an XML-editor

To use jEdit as an XML-editor make sure that the proper plugins are installed:
    XML, XML indenter, XQuery plugin, see

jEdit as an Advanced XML Editor: 
    http://www.adrem.ua.ac.be/~wellenslepage/jedit_as_axe/

If they are not installed, you must install them in your jEdit settings directory (homedir\.jEdit).

Before installing, set Download options: download in: jEdit settings directory.

 

In order to be able to use jEdit for XML-validation and XQuery-ing be sure that SaxonAdapter.jar is in .jEdit/jars in your home-directory on the C-drive. If it is not, copy it from the jars directory of jEdit's installation directory.

When using the XQuery-plugin and has relative file references like doc("bib.xml") it is important to set the base URI correct: the slashes must be / and not back-slashes (\) and it must end with a slash.

 

 

If you edit the XQuery files in jEdit, it may be a problem to save the file after you have tried to execute the query. To avoid this, use menu:
Utilities | Global Settings | jEdit | General | two stage save, UNCHECK.

 

 

Exist, XML-database

In the e-bar you have access to the Exist XML-database server at csbase2.imm.dtu.dk.

See its webpage at http://csbase2.imm.dtu.dk:8080/exist/index.xml

Use the client shell to create new collections, insert new xml-documents and make queries to your collection of xml-documents. To start the client shell execute the client.bat file in the eXist installation directory: ....\eXist\bin\client.bat (make a shortcut to your desktop):

 

 

You must ask the assistant teacher or Hans Bruun for a username and password.

 

Berkeley DB-XML, XML-database

Is not a server based database. Has a simple shell,
    start with Programs: Berkeley DB XML: Berkeley DB XML shell.

BDB XML is intended to be used as a library that is linked directly into your application. Read the documentation at Programs: Berkeley DB XML: On Disk Documentation.

 

 

Altova XML 2006

See http://www.altova.com/altovaxml.html

 

 

 

 

Hans Bruun     (  hab@imm.dtu.dk ) 08-05-2006