- Let Me Get This Straight, Apache Derby Is IBM Cloudscape?
- Development of the Apache Derby Database—Who Can Contribute and How?
- How Can IBM Sell a Product for Profit and Contribute the Same Product to the Open Source Community?
- How an Open Source Database Like Apache Derby Can Help
- Why the Need for a Local Data Store?
- Why Use a Relational Database?
- How the Apache Derby Platform Can Help Your Business
- A High-Level View of the Apache Derby Database
- The Apache Derby Components
- Developing Apache Derby Applications
Developing Apache Derby Applications
Because Apache Derby is a Java-based database engine, most application developers will choose to program their applications using the JDBC API. Cloudscape supports Java applications written in JDBC 2.0 and 3.0.
An Apache Derby application follows the same general methodology as other Java-based applications in that a proper JDBC driver is loaded, a connection is made to the required database, a statement object is created, and finally the statement object is used to execute some business logic (generally an SQL statement or a stored procedure). Prepared statements are also supported in Apache Derby, as well as parameter markers, which deliver an excellent performance boost for your applications. In addition, the Apache Derby database leverages the Java just-in-time (JIT) compiler for better performance through native operational profiling.
The only Apache Derby-specific code outlined in the previous paragraph is the loading of the JDBC driver and the uniform resource locator (URL) you would specify in the connection string. This means your Apache Derby applications can be easily altered to use other JDBC-compliant databases, such as DB2, Informix, and so on, by loading the appropriate driver class.
One very strong feature of Apache Derby is that the SQL API is 100% compatible with DB2, so if you ever decide to trade up for a full-fledged database, the migration to DB2 would be effortless. (There is also a free Eclipse-based migration toolkit for Apache Derby-to-DB2 migrations!) We bet you did not know that being an Apache Derby developer meant you were a DB2 developer too. Investing your skills in Apache Derby is definitely a resume-builder!
You can use almost any Java-based IDE to develop your Apache Derby-based applications. For example, you can use WebSphere Studio Application Developer (WSAD), Borland JBuilder, netBeans, and so on.
In keeping with the open source tradition, a plug-in is available for the Eclipse framework to equip application developers with a rich toolset for developing Apache Derby applications. Of course, you can also choose to write your applications the old-fashioned way, using your favorite editor such as emacs or vi—whatever suits your needs. When using a separate tool to help with application development, remember that you should probably have the Apache Derby Network Server installed as well.
The IBM DB2 plug-in for Eclipse lets you explore and create schemas for your DB2, Apache Derby, IBM Cloudscape, and Informix databases. An example of the Eclipse IDE with this plug-in is shown in Figure 1-2.
Figure 1-2 Using free open source Eclipse-based IDEs to work with Apache Derby databases
This plug-in also comes with a migration toolkit that allows you to migrate your Apache Derby schema to a DB2 database. Over time, expect to see more and more features driven into the plug-in and the Eclipse framework. (It is open source after all, so we are counting on some of you to contribute!)
Of course, there are other programming interfaces that you can use to develop applications and the tooling that goes along with it: for example, ODBC, CLI, .NET, Perl, and PHP will all be supported. You’re going to learn a whole lot about application development with Apache Derby from this book.