Clone wiki

semdiff / Setting_up_a_Database

Setting up a Database

To use SemDiff, you need to setup a database that will store the various results computed by SemDiff. SemDiff supports two databases: HSQLDB and PostgreSQL. Once you have selected the database you want to use, you need to initialize it: when selecting the menu option "SemDiff / Init Database", SemDiff creates the appropriate schema (tables, constraints, etc.) in the database.

HSQLDB

HSQLDB database is bundled with SemDiff so you do not need to install it. To initialize the database, select the menu option "SemDiff / Init Database". Then, enter the following information:

  • Username: sa
  • Password: <Leave it empty>
  • Connection String: jdbc:hsqldb:file:/home/myuser/semdiff/db/hsql;hsqldb.default_table_type=cached
  • Driver: Choose "org.hsqldb.jdbcDriver"
  • Dialect: Choose "org.hibernate.dialect.HSQLDialect"

/home/myuser/semdiff/db is the path where the database will be located and hsql is the name of the db. You can change them as you like. hsqldb.default_table_type=cached means that HSQLDB will put some of the data in memory and some of the data on the disk. This is the desired behavior since large repositories would probably not fit in your memory. HSQLDB web site contains more information on the options available for JDBC connection strings.

PostgreSQL

You need to manually install PosgreSQL if you want to use it. In our experience, this database usually provides better performance than HSQLDB for large repositories. We have tested PostgreSQL 8.3 with SemDiff, but previous versions should work too. Before SemDiff can initiale a PostgreSQL database, you must create a database instance. A good tool to do that is pgAdmin. Once you have created a database instance, you can initialize it by selecting the menu option "SemDiff / Init Database". Then, enter the following information:

  • Username: <a valid postgresql username>
  • Password: <your password>
  • Connection String: jdbc:postgresql:localhost:5432/database_name
  • Driver: Choose "org.postgresql.Driver"
  • Dialect: Choose "org.hibernate.dialect.PostgreSQLDialect"

localhost:5432 is the address of the machine hosting PostgreSQL and database_name is the name of your database instance. PostgreSQL web site contains more information on the options available for JDBC connection strings.

Updated