Apache Maven is a ubiquitous tool for Java development since it is very useful for managing dependencies on third party libraries in a transparent and maintainable way. From an application’s perspective is Mimer SQL JDBC driver such a third party library and it is available on Maven Central and can thus easily be included in a project’s POM.

Here is a very basic Java application that connects to a database on localhost called “mimerdb”. Save the source file as src/com/mimer/mvnMimerJDBC.java and the POM as pom.xml or download the source, then build and run the project:

mvn package
java -jar target/mvnMimerJDBC-1.0.jar

This is the java source for the example:

package com.mimer;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class mvnMimerJDBC {
    static String dbHost = "localhost";
    static String dbName = "mimerdb";
    static String dbUser = "SYSADM";
    static String dbPass = "SYSADM";
    static Connection connection = null;

     * A very basic connection routine
     * @return true if the connection was successful, false otherwise
    private static boolean connectToMimer() {
        try {
        } catch (ClassNotFoundException e) {
            System.out.println("Failed to load JDBC driver");
            return false;

        try {
            String s = "jdbc:mimer://" + dbHost + "/" + dbName;
            connection = DriverManager.getConnection(s, dbUser, dbPass);
        } catch (SQLException e) {
            System.out.println("Failed to connect to database");
            return false;
        return true;

     * To display some data from the database we use the system table "MANYROWS". It contains 366 records
     * of integers, 1 to 366, stored in one column named "C" and is perfect for this type of test run
    private static void getDataFromMimer() {
        PreparedStatement preparedStatement;

        try {
            String queryStatement = "SELECT C FROM SYSTEM.MANYROWS";
            preparedStatement = connection.prepareStatement(queryStatement);
            ResultSet rs = preparedStatement.executeQuery();
            while (rs.next()) {
                int c = rs.getInt("C");
                System.out.format("%s\n", c);
        } catch (SQLException e) {

    public static void main(String[] args) {
        if (connectToMimer())

A corresponding POM file can look like this:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">