Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Make Java DB Your Client-side Portable Database

By embedding Java DB in your Java application, you provide a portable database that launches and shuts down as the application does. If that's not enough, you can create XML schemas on the fly using XML files and insert rows into a table without using SQL too.


advertisement
n exclusive, embedded database for a Java application is a marvelous idea, the full potential of which may not be realized for some time. Currently, you could use it as a supplemental client-side database in desktop and browser applications or as a backup database should something go wrong with the network database.

A networked database serves as a persistence repository for various applications' business data, but every application contains a lot of data that is not business-related, such as user personal screen settings, etc. Storing this non-business-related data in a networked database server wastes valuable network and database resources. Having this type of data available only during the lifetime of the application makes sense. Java DB offers a perfect solution in this case.

Java DB is a 100 percent Java-based, lightweight RDBMS that can be run with any standard Java Virtual Machine. Though lightweight, it meets the ACID (Atomic, Consistent, Isolation, Durable) properties of the relational database system. As such, it will recover data up to before a crash without losing committed data or risking corruption. It supports all the relational database standards such as SQL and JDBC. As a result, it is platform independent and interoperable with any open standards-based database.



While Java DB provides various features, of most interest to the developer are the abilities to create XML schemas on the fly using XML files and insert rows into a table without using SQL. Traditionally developers used SQL to process DML statements from Java, but Java DB enables them to accomplish the same task without SQL. This article explores in detail these features and demonstrates them with a sample application that stores and retrieves user settings in an embedded database using Swing.

The DdlUtils Component

Java parsers provide an easy way to parse and navigate complex XML documents. The DdlUtils component is based on a similar concept, providing utilities to enable direct data navigation and manipulation inside database tables from Java code. You can create an entire database schema in XML on the fly using DdlUtils, and DdlUtils also supports reverse engineering of existing schemas into XML or Java objects. So while Java DB takes care of database-related functionality such as transaction management, concurrency, backups, etc., DdlUtils handles interactions with the database.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap