Child pages
  • TopicMap Engine Home

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: moved to

This page has been moved to the Atlassian cloud

This page can now be found at:


TM2JDBC is a implementation of the TopicMaps API (TMAPI 2.0.2). It is a fast, production-grade Topic Maps Engine with a small dependency footprint. TM2JDBC uses a relational database to store its data, and is verified to operate with Apache Derby, MySQL, MSSQL Server and Oracle databases.


If you are using maven, you can use the new version by adding the following snippets to your pom.xml file:


No Format

  <name> repository.</name>

If you do not use maven, you can download the .jar files manually from our repository at
Alternatively, you can check out the sources directly from our SVN Repository:


To handle database connectivity, the TM2JDBC engine relies on ajavax.sql.DataSource to be set for the property in the Factory (attempting to call newTopicMapSystem() without the property being set causes anIllegalStateException to be thrown. The property string can also be accessed directly via the Enum objectorg.clazzes.tm2jdbc.voc.PropertyKey.CONNECTION_DATASOURCE. The most basic setup could look like this:


Code Block
BasicDataSource datasource = new BasicDataSource();




TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance();
factory.setProperty(PropertyKey.CONNECTION_DATASOURCE.getURI(), dsProvider.getDataSource());

TopicMapSystem system = factory.newTopicMapSystem();

Running the DBSetup Utility in commandline

The engine provides a setup-utility to create the tables it needs in a provided database schema. This utility can either be run as a standalone java executable (in the command line, via a shell script etc.) or instanciated as a Java Object by your own code (see below). The class name is org.clazzes.tm2jdbc.jdbc.setup.DBSetup. For testing and development, it may be useful to run the setup utility in commandline or the development evironment of your choice. The standard use-case is to set up the database schema, but you can also use it to drop all tables in the schema.
Making sure that the appropriate database drivers are added to the classpath, the accepts arguments like this:


No Format
DBSetup {derby|mssql|mysql|oracle} {{ [-h <HOSTNAME>] [-t <PORT>] [-n <SCHEMA NAME>] } | {--url <DATABASE-URL>}} -u <USER> -p <PASSWORD> [-d <DRIVER-CLASSNAME> ] [--debug] [--drop|--force-drop] [--nosetup]

Below is a listing of all argument flags and the default values:

FlagDefault ValueDescription
-h127.0.0.1The hostname/address of your database server. Caution: When using Oracle database systems, the hostname is interpreted as a TNS name, which is resolved to an IP locally. Alternatively, you may also specify a string like<IP-HOST>/<SID>
-tdefault portIf omitted, the default port for the specified database server is used

--urlnoneAlternatively to entering the hostname, port and schema name, you can supply the jdbc url directly.
-unoneYou must enter a username and password

-ddefault driver classIf you want to use a different driver class than the default, you can specify the fully qualified classname using this flag. Make sure that the class is added to the classpath.
--debugfalseProduces a verbose output
--dropfalseDrops all tables in the schema, causes the utility to fail on errors
--force-dropfalseDrops all tables in the schema, ignoring any errors (Use to clean the schema if it was corrupted or not created completely)
--nosetupfalseSkip setting up the schema.

Running the DBSetup Utility in Java


TMAPI provides an extensive suite of Testcases to assure compliancy, which is also included in the TM2JDBC package. As the original tests were not conceived for engines which are based on an RDBMS, the setUp() and tearDown() methods where modified to initialize and drop the database schema between every test. You are welcome to subject the engine to additional tests (we would especially appreciate you to share the results with us), and for this purpose TM2JDBC provides the utility classorg.clazzes.tm2jdbc.util.test.DataSourceProvider (depends on Apache commons DBCP).
It is recommended to use this utility in all test cases as follows:


Code Block
protected DataSourceProvider dsProvider;

protected void setUp() throws Exception {
	if (dsProvider == null) {
		dsProvider = DataSourceProvider.getProvider();
		//set up factory etc. here ...
		factory.setProperty(PropertyKey.CONNECTION_DATASOURCE.getURI(), dsProvider.getDataSource());

protected void tearDown() throws Exception {

Source code and issue tracker


Jira: TME