Freitag, 17. April 2009

Using Derby in a comfortable way in eclipse

Today I decided to test if Derby is better then hsqldb from the usablility poit of view. After a few hours I found a very comfortable way to integrate derby into my eclipse. I created a small test project with a hibernate setup and tests. Everything worked fine. IMHO Derby is simple to set up and its simple to have a look in the database tables. At least more simple than it is using hsqldb. If anyone is interested in the manuals that helped me to set up the environment, heres a link list:
  • Integrating derby into eclipse:

    Note: In the projects properties you can modify the path, where Derby stores the database files.
  • Starting the database network server:
  • Using Squirrel as front end:
This is the hibernate setup I used:

public static SessionFactory createDerbyFactory() {
 AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration();
 annotationConfiguration.setProperty("hibernate.connection.driver_class", "org.apache.derby.jdbc.ClientDriver");
 annotationConfiguration.setProperty("hibernate.connection.url", "jdbc:derby://localhost:1527/simpletest");
 annotationConfiguration.setProperty("hibernate.connection.username", "user");
 annotationConfiguration.setProperty("hibernate.connection.password", "user");
 annotationConfiguration.setProperty("hibernate.dialect", "org.hibernate.dialect.DerbyDialect");
 annotationConfiguration.setProperty("hibernate.show_sql", "true");
 annotationConfiguration.setProperty("hibernate.format_sql", "true");
 annotationConfiguration.setProperty("", "create-drop");
 return annotationConfiguration.buildSessionFactory();

In order to use this setup, you need to create a derby database. How to do this, is described here:

Keine Kommentare:

  © Blogger template 'Morning Drink' by 2008

Back to TOP