LexAccess

Java DB (Derby)

Description

Sun Java DB is based on the open source Apache Derby project. It provides a full-featured, robust, small-footprint Java database management system that is cost effective and simple to deploy. Java DB is Sun's supported distribution of the open source Apache Derby 100% Java technology database. It is fully transactional, secure, easy-to-use, standards-based — SQL, JDBC API, and Java EE — yet small, only 2MB. The Apache Derby project has a strong and growing community that includes developers from large companies such as Sun Microsystems and IBM as well as individual contributors.

Features

  • Pure Java: write once, run anywhere to supports 2SE, J2EE and J2ME standards
  • Standards-based: JDBC and ANSI SQL standards
  • Provides both embedded and client-server modes
  • Secure: file encryption, authentication through either external LDAP directory or built-in repository, and authorization
  • Sophisticated: with triggers and stored procedures
  • Small foot-print: With a foot-print of 2MB

License

Usage Summary

  • download derby.jar to ${LA_DIR}/lib/jdbcDrivers/JavaDb
  • Use JDBC in Java to perform database query
  • jdbc driver: org.apache.derby.jdbc.EmbeddedDriver
  • jdbc url: jdbc:derby:${DB_NAME}
  • set properties in Java code when get DB connection
    • derby.system.home: ${LA_DIR}/data/JavaDb
    • derby.storage.tempDirectory: ${DERBY_HOME}/temp/laTemp
    • derby.stream.error.file: ${DERBY_HOME}/temp/laLog.LOG
  • Set DB to read-only
    => Change mode to read only in ${LA_DIR}/data/JavaDb/${DB_NAME} after loading all tables
  • Performance tune up (derby.properties)
    • derby.storage.pageCacheSize=10000 (default 1000, must reboot JavaDb)
    • derby.storage.pageSize=32768 (default 8192)
    • derby.storage.pageReserveSpace=0 (for read-only, default 60)

References

Please refer to JavaDB Web site.