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:

Dienstag, 14. April 2009

Ein Witz in der Java API Doc

May the force be with you :-) -->

Here are some examples of usage:

     Object[] arguments = {
         new Integer(7),
         new Date(System.currentTimeMillis()),
         "a disturbance in the Force"

     String result = MessageFormat.format(
         "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",

     output: At 12:30 PM on Jul 3, 2053, there was a disturbance
               in the Force on planet 7.

  © Blogger template 'Morning Drink' by 2008

Back to TOP