Java Tutorial - Java Script : McKoi

Java Tutorial - Java Script :

McKoi

McKoi is an open source Java database released by Diehl and Associates, Inc. under the Gnu Public License. McKoi is not a part of a larger open source project or community but seems to be primarily supported by an individual developer. The product summary for McKoi can be found in the following table McKoi is more of a traditional database than HSqlDb and is more full featured that Axion. McKoi stores data files on disk and caches data in memory. Like HSqlDb, however, McKoi can be used as a database embedded into another program or as a standalone server that is accessed via a database client. McKoi provides a separate file for the JDBC driver, providing a smaller footprint for JDBC client-only applications.


License Issues:

Unfortunately, both the McKoi server and the JDBC driver are covered under the GPL license. This forces products that want to use and distribute McKoi to use a license that is GPL compatible. Unfortunately, the Apache license is not considered GPL compatible. This causes problems for those projects that would benefit by combining GPL-protected software with software covered under the Apache license. This would not have been a problem if McKoi had been released under the LGPL license or if the JDBC driver had been released as LGPL. Because it is impossible to access the McKoi database without linking to either the McKoi server or the JDBC client, McKoi shouldn’t be used with Tomcat or any other Java application covered under the Apache license. This is unfortunate because McKoi is a very attractive product from a standpoint of features and performance.

 This license-compatibility problem only affects programs that will be distributed to others. It does not affect personal software or programs that are private to a business and will not be distributed to other users.



McKoi Installation:

McKoi can be installed by downloading the distribution and decompressing it into the directory of your choice. After the files have been copied, a new empty database can be created using the following command:

java -jar mckoidb.jar –create “admin” “admin_pass

 admin is the name to use for the administrative user and “admin_pass” should be replaced by an appropriate password. To start McKoi running in server mode use the following command.

 java -jar mckoidb.jar

 The running server can be accessed from a McKoi command tool. This tool is started by the following command:

java -cp mckoidb.jar com.mckoi.tools.JDBCQueryTool \ -u “admin” -p “admin_pass”

The McKoi command tool shown in Figure 8.5 is considerably more primitive than the tool providedby HSqlDb. Fortunately, the HSqlDb tool also works with McKoi in both server and nonserver modes of operation
. To stop the McKoi server, use the following command:

 java -jar mckoidb.jar -shutdown admin admin_pass

 Use the following class and URL to access a McKoi database with McKoi running as a server from a Java program using JDBC:

 com.mckoi.JDBCDriver
 jdbc:mckoi://localhost/

 where localhost is the machine name of the server.

Note that McKoi, by default, stores its configuration information in the file called db.conf. There are several values that may be of interest here. First, note that the references to the database_path and log_path are relative. If you will be running McKoi from a different working directory than the one used when the database was created, these should be made absolute. For example, instead of:

database_path=./data
log_path=./log

you might want to use:

database_path=c:/openjava/mckoi0.94h/data
log_path=c:/openjava/mckoi0.94h/log

The other value that you may want to change is:

ignore_case_for_identifiers=disabled

Figure 8.5 McKoi command tool

By default, McKoi is case sensitive for table names. However most SQL environments are case insensitive. Changing disabled to enabled addresses this issue.