Question

I am looking for a document DB supporting Windows XP 32 bits, satisfying the following requirements:

  • The support must not be discontinued. I.e. I want to be able to install the most recent version of the DB. MongoDB does not fit, since they dropped supporting XP and CouchDB does not fit since they dropped supporting any Windows 32 bits.
  • It should be relatively simple. Obviously, the application is not an enterprise one, so a complex DB, like Cassandra, is out. In fact, I would like to avoid column databases, since I think they exist to solve enterprise level problems, which is not the case here. On the other hand, I do not want relational DBs, because I want to avoid DB upgrades each time new fields are added (and they will be added).
  • It should support indexing on part of the document, like MongoDB. I could use a relational DB, like hsqldb to store the data as json string. This lets adding new fields easy - no schema needs to be changed. But these fields would not be indexable by the database. Again, unlike MongoDB.
  • Finally, the DB will run on the same machine as the application itself - one more down for MongoDB, which would steal all the RAM from the application to itself.

So, in a sense, I am looking for something like MongoDB, but with the support of Windows XP 32 bits.

Any advices?

P.S.

I know that Windows XP has one year to live before MS drops supporting it. However, I have to support XP anyway.

Was it helpful?

Solution

With HSQLDB and some other relational databases, you store the document as a CLOB. This clob can be accessed via a single table which contains the index for all the indexed fields. For example

CREATE TABLE DATAINDEX(DOCID BIGINT GENERATED BY DEFAULT AS IDENTITY, FIELDNAME VARCHAR(128), FIELD VARCHAR(10000),
    DOCUMENT CLOB, PRIMARY KEY (DOCID, FIELDNAME))

CREATE INDEX IDS ON (FIELDNAME, FIELD);

The whole document is the CLOB. A copy of selected fields that need an index for searching is stored in the (fieldnname, field) columns. The rows with the same DOCID will have the same CLOB in the DOCUMENT column. One row is inserted with the first field and the clob, then it is duplicated by selecting and inserting the existing DOCID and clob with the second field and so on.

-- use this to insert the CLOB with the first field
INSERT INTO DATAINDEX VALUES DEFAULT, 'f1', 'fieldvalue 1', ?
-- use this to insert the second, third and other fields
INSERT INTO DATAINDEX VALUES
    IDENTITY(), 'f2', 'filedvalue 2', 
    (SELECT DOCUMENT FROM DATAINDEX WHERE DOCID = IDENTITY() LIMIT 1)

The above is just one example. You can create your own DOCID. The principle is to use the same DOCID and to insert the first row with the CLOB. The second and third rows select the DOCID and the clob from the previously inserted row to create new rows with the other fields. You will probably use JDBC parameters to insert into the FIELDNAME and FIELD columns.

This allows you to perform searches such as:

SELECT DOCID, DOCUMENT FROM DATAINDEX 
    WHERE FIELDNAME = 'COMPANY NAME' AND FIELD LIKE  'Corp%'

This may not satisfy all your requirements, but the answer is intended to cover what is possible with HSQLDB.

OTHER TIPS

Which programming framework are you using? If .NET is a possibility you can try RavenDB. It can be used as both an embedded and standalone database.

For Java you can try out OrientDB. It is also embeddable: https://github.com/nuvolabase/orientdb/wiki/Embedded-Server

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top