Difference between revisions of "JavaQM-API"

From ScarletDME
Jump to navigation Jump to search
(Added supported features)
Line 5: Line 5:
Binary (Jar) download is available here: [http://www.scarletdme.org/downloads/JavaQMConnect-0.8.jar JavaQMConnect-0.8.jar]
Binary (Jar) download is available here: [http://www.scarletdme.org/downloads/JavaQMConnect-0.8.jar JavaQMConnect-0.8.jar]
To use simply download the Jar file and place it in the ClassPath or same directory as your own Java Program. See the example below for more details.
===Source code===
===Source code===

Revision as of 12:18, 14 September 2009

This Java API library is a native Java library, which allows you to access QM via the QMClient network interface.

All you need is QMClient running on the server, the IP address, a valid username and password and the Account you want to access.


Binary (Jar) download is available here: JavaQMConnect-0.8.jar

To use simply download the Jar file and place it in the ClassPath or same directory as your own Java Program. See the example below for more details.

Source code

LGPL licenced source code for this library are available in the following locations:

The latest Source is available from the subversion repo https://ScarletDME.org/svn/qmvdb/JavaQMClient

 svn checkout https://scarletdme.org/svn/qmvdb/JavaQMClient/trunk

Or as a source tar ball if you don't want to use Subversion JavaQMConnect-0.8.tar.gz

Both of the above are structured by Netbeans IDE. It is not necessary to use Netbeans if you don't want to, thought I do recommend it. A simple text editor and the Ant build utility would be enough. Or other IDE's like Eclipse will import this structure fine.

Commercial Support

For commercial support or new features Contact Adrian Tesson Associates (http://Tesson.co.uk)

Supported Protocol Features

The Java API library supports the following features that the qmclient protocol provides;

  • 1 Quit
  • 2 Get extended error text
  • 3 Set account
  • 4 Open file
  • 5 Close file
  • 6 Read record (READ)
  • 7 Read record (READL)
  • 8 Read record (READL, waiting)
  • 9 Read record (READU)
  • 10 Read record (READU, waiting)
  • 11 Select file
  • 12 Read next id from select list
  • 13 Clear select list
  • 14 Read select list
  • 15 Release lock
  • 16 Write record
  • 17 Write record, retaining lock
  • 18 Delete record
  • 19 Delete record, retaining lock
  • 20 Call catalogued subroutine
  • 21 Execute command
  • 22 Response to input
  • 23 End command Not Supported
  • 24 Network login
  • 25 QMLocal login Not Supported
  • 26 Select index
  • 27 Enter licensed package Not Supported
  • 28 Exit licensed package Not Supported
  • 29 Open QMNet file Not Supported
  • 30 Lock a record
  • 31 Clearfile Not Supported
  • 32 Get file lock Not Supported
  • 33 Release file lock Not Supported
  • 34 Test lock Not Supported
  • 35 Fetch information about indices Not Supported
  • 36 Fetch information about an index Not Supported
  • 37 Select file and return list
  • 38 Select index, returning indexed values
  • 39 Select index, returning keys for value
  • 40 Perform FILEINFO() action Not Supported
  • 41 READV and variants Not Supported
  • 42 Set index at extreme left
  • 43 Set index at extreme right
  • 44 Scan index to left
  • 45 Scan index to right
  • 46 Enable/disable mark mapping Not Supported


Here is an example of how to use the JavaQM API Lib. Simply place the Jar in the library path or same directory as your classes or Jar file.

import com.openqm.qmconnect.*;

/** Example program that accesses QM with the Java API */
public class Example {
    Example() {
        try {
            /* Initialise the connection */
           QmConnection connection = QmConnection.create("localhost",4243);        
           /* Tell it to log in */
           connection.connect("testuser", "password", "QMSYS");
           /* Open Up the VOC file as an example */
           QmFile vocFile = connection.open("VOC");
           /* Read from the Opened VOC file */
           String record = connection.read(vocFile, "MESSAGES");

           System.out.println("This is the MESSAGES Record from the VOC file: " + record);
        } catch (QMException e) {
            System.err.println("Error occurred connecting to QM");