Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
414 lines (353 sloc) 16.6 KB
permalink sidebar title keywords toc Tags previous next
connectors.html
mydoc_sidebar
Connectors
Connector, Connectors, Oracle, SQL Server, DB2, AS400
false
Connector, Connectors, Oracle, SQL Server, DB2, AS400
enterprise_plugins.html
author.html

{% include prev_next.html %}

Open Source Connectors

MySQL

Speedment supports MySQL out-of-the-box. Please refer to the Speedment Initializer to setup your MySQL project.

Starting from version 3.0.11, the MySQL FieldPredicatView can be configured to use custom collations by modifying the following configuration parameters:

Name Default value
db.mysql.collationName utf8_general_ci
db.mysql.binaryCollationName utf8_bin

These values can be set to custom values using the application builder as depicted below:

     ApplicationBuilder app = new SakilaApplicationBuilder()
        .withPassword("sakila-password")
        .withParam("db.mysql.collationName", "utf8mb4_general_ci")
        .withParam("db.mysql.binaryCollationName", "utf8mb4_bin");
        .build();

The selected collations will be used for all MySQL tables.

Speedment officially support the following MySQL JDBC versions:

Database groupId artifactId version
MySQL mysql mysql-connector-java 5.1.46

PostgreSQL

Speedment supports PostgreSQL out-of-the-box. Please refer to the Speedment Initializer to setup your PostgreSQL project.

Speedment officially support the following PostgreSQL JDBC versions:

Database groupId artifactId version
PosgreSQL org.postgresql postgresql 42.2.2

MariaDB

Speedment supports MariaDB out-of-the-box. Please refer to the Speedment Initializer to setup your MariaDB project.

Starting from version 3.0.11, the MariaDB FieldPredicatView can be configured to use custom collations by modifying the following configuration parameters:

Name Default value
db.mysql.collationName utf8_general_ci
db.mysql.binaryCollationName utf8_bin

These values can be set to custom values using the application builder as depicted below:

     ApplicationBuilder app = new SakilaApplicationBuilder()
        .withPassword("sakila-password")
        .withParam("db.mysql.collationName", "utf8mb4_general_ci")
        .withParam("db.mysql.binaryCollationName", "utf8mb4_bin");
        .build();

The selected collations will be used for all MariaDB tables.

{% include important.html content= " Some Linux distributions (notable Debian/Ubuntu) requires the utf8mb4 collations to be used as per instructions above. " %}

Speedment officially support the following MariaDB JDBC versions:

Database groupId artifactId version
MariaDB org.mariadb.jdbc mariadb-java-client 2.2.3

{% include important.html content= " Pre 2.0.1 MariaDB JDBC drivers contain significant bugs. Users are highly encouraged to upgrade to 2.x.x drivers. " %}

Enterprise Connectors

Support for additional enterprise database types can easily be obtained by adding an appropriate connector. Adding a connector is straight forward:

  • Add a connector dependency in your pom file
  • Mention the connector's Bundle in the speedment enterprise plugin
  • Mention the connector's Bundle in your ApplicationBuilder

{% include important.html content= " In order to use the connectors in this chapter, you need a commercial Speedment license or a trial license key. Download a free trial license using the Speedment Initializer. " %}

Oracle

This chapter shows how to add support for Oracle in Speedment. Unfortunately, Oracle does not provide a JDBC driver that you can download via a dependency in your pom file. Instead, it has to be installed manually before you can use the Oracle connector. Here is Oracle's official JDBC FAQ that provides information on how to install the Oracle JDBC driver.

Privileges

In order for the Speedment tool to read the schema metadata you need the following privileges:

Privilege Create Example
CREATE SESSION GRANT CREATE SESSION TO SPEEDMENT_USER;
SELECT GRANT SELECT ON t TO SPEEDMENT_USER; (*)
ANALYZE GRANT ANALYZE ANY TO SPEEDMENT_USER;
ANALYZE DICTIONARY GRANT ANALYZE DICTIONARY TO SPEEDMENT_USER;

(*) Repeat for each and every table t being used.

When the application runs, only the CREATE SESSION and the SELECT privileges are needed (plus UPDATE/DELETE if those operations are being used within the Speedment application).

Oracle POM

Always use the Initializer to get a complete POM file template as the POM snipes hereunder just show portions of what is needed.

Here is how you configure the speedment enterprise plugin:

    <plugin>
        <groupId>com.speedment.enterprise</groupId>
        <artifactId>speedment-enterprise-maven-plugin</artifactId>
        <version>${speedment.enterprise.version}</version>
        <dependencies>
            <dependency>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc7</artifactId>
                    <version>12.1.0.1.0</version>
                    <scope>runtime</scope>
                </dependency>
            </dependency>
        </dependencies> 
        <configuration>
            <components>
                 <component>com.speedment.enterprise.connectors.oracle.OracleBundle</component>
            </components>
            <parameters>
                <parameter>
                    <name>licenseKey</name>
                    <value>(YOUR LICENSE CODE)</value>
                </parameter>
            </parameters>
        </configuration>
    </plugin>

You also have to depend on the Oracle connector and JDBC connector as a runtime dependency for your application:

    <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0.1.0</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.speedment.enterprise.connectors</groupId>
            <artifactId>oracle-connector</artifactId>
            <version>${speedment.enterprise.version}</version>
        </dependency>
        <dependency>
            <groupId>com.speedment.enterprise</groupId>
            <artifactId>runtime</artifactId>
            <version>${speedment.enterprise.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>

Oracle Application

When you build the application, the OracleBundle needs to be added to the runtime like this:

    YourApplication app = new YourApplicationBuilder()
        .withPassword("your-dbms-password")
        .withParam("licenseKey", "(YOUR LICENSE CODE)")
        .withBundle(OracleBundle.class)
        .build();

{% include tip.html content= " The Oracle JDBC driver has many features (e.g. redundancy, pooling and other optimizations) that can be controlled using the connection URL. To activate these functions, use the method ApplicationBuilder::withConnectionUrl to specify a custom connection URL. " %}

{% include note.html content= " The JDBC driver version above is the one officially supported by Speedment. Other JDBC versions may also work. " %}

SQL Server

This chapter shows how to add support for Microsoft SQL Server in Speedment.

SQL Server POM

Always use the Initializer to get a complete POM file template as the POM snipes hereunder just show portions of what is needed.

Here is how you configure the speedment enterprise plugin:

    <plugin>
        <groupId>com.speedment.enterprise</groupId>
        <artifactId>speedment-enterprise-maven-plugin</artifactId>
        <version>${speedment.enterprise.version}</version>
        <dependencies>
            <dependency>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>mssql-jdbc</artifactId>
                <version>6.1.0.jre8</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
        <configuration>
            <components>
                <component>com.speedment.enterprise.connectors.sqlserver.SqlServerBundle</component>
            </components>
            <parameters>
                <parameter>
                    <name>licenseKey</name>
                    <value>(YOUR LICENSE CODE)</value>
                </parameter>
            </parameters>
        </configuration>
    </plugin>

You also have to depend on the Sql Server connector and JDBC connector as a runtime dependency for your application:

    <dependencies>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>6.1.0.jre8</version>
            <scope>runtime</scope>
        </dependency>
            <dependency>
            <groupId>com.speedment.enterprise.connectors</groupId>
            <artifactId>sqlserver-connector</artifactId>
            <version>${speedment.enterprise.version}</version>
        </dependency>
        <dependency>
            <groupId>com.speedment.enterprise</groupId>
            <artifactId>runtime</artifactId>
            <version>${speedment.enterprise.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>

SQL Server Application

When you build the application, the SqlServerBundle needs to be added to the runtime like this:

    YourApplication app = new YourApplicationBuilder()
        .withPassword("your-dbms-password")
        .withParam("licenseKey", "(YOUR LICENSE CODE)")
        .withBundle(SqlServerBundle.class)
        .build();

{% include tip.html content= " The SQL Server JDBC driver has many features (e.g. redundancy, pooling and other optimizations) that can be controlled using the connection URL. To activate these functions, use the method ApplicationBuilder::withConnectionUrl to specify a custom connection URL. " %}

{% include note.html content= " The JDBC driver version above is the one officially supported by Speedment. Other JDBC versions may also work. " %}

DB2

This chapter shows how to add support for IBM DB2 in Speedment. Unfortunately, IBM does not provide a JDBC driver that you can download via a dependency in your pom file. Instead, it has to be installed manually before you can use the DB2 connector. Here is IBM's official JDBC download page.

DB2 POM

Always use the Initializer to get a complete POM file template as the POM snipes hereunder just show portions of what is needed.

Here is how you configure the speedment enterprise plugin:

    <plugin>
        <groupId>com.speedment.enterprise</groupId>
        <artifactId>speedment-enterprise-maven-plugin</artifactId>
        <version>${speedment.enterprise.version}</version>
        <dependencies>
            <dependency>
                <groupId>com.ibm.db2</groupId>
                <artifactId>db2jcc4</artifactId>
                <version>4.21.29</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
        <configuration>
            <components>
                <component>com.speedment.enterprise.connectors.db2.Db2Bundle</component>
            </components>
            <parameters>
                <parameter>
                    <name>licenseKey</name>
                    <value>(YOUR LICENSE CODE)</value>
                </parameter>
            </parameters>
        </configuration>
    </plugin>

You also have to depend on the DB2 connector and JDBC connector as a runtime dependency for your application:

    <dependencies>
        <dependency>
            <groupId>com.ibm.db2</groupId>
            <artifactId>db2jcc4</artifactId>
            <version>4.21.29</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            groupId>com.speedment.enterprise.connectors</groupId>
            <artifactId>db2-connector</artifactId>
            <version>${speedment.enterprise.version}</version>
        </dependency>
        <dependency>
            <groupId>com.speedment.enterprise</groupId>
            <artifactId>runtime</artifactId>
            <version>${speedment.enterprise.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>

DB2 Application

When you build the application, the Db2Bundle needs to be added to the runtime like this:

    YourApplication app = new YourApplicationBuilder()
        .withPassword("your-dbms-password")
        .withParam("licenseKey", "(YOUR LICENSE CODE)")
        .withBundle(Db2Bundle.class)
        .build();

{% include tip.html content= " The DB2 JDBC driver has many features (e.g. redundancy, pooling and other optimizations) that can be controlled using the connection URL. To activate these functions, use the method ApplicationBuilder::withConnectionUrl to specify a custom connection URL. " %}

{% include note.html content= " The JDBC driver version above is the one officially supported by Speedment. Other JDBC versions may also work. " %}

AS400

This chapter shows how to add support for IBM AS400 in Speedment.

AS400 POM

Always use the Initializer to get a complete POM file template as the POM snipes hereunder just show portions of what is needed.

Here is how you configure the speedment enterprise plugin:

    <plugin>
        <groupId>com.speedment.enterprise</groupId>
        <artifactId>speedment-enterprise-maven-plugin</artifactId>
        <version>${speedment.enterprise.version}</version>
        <configuration>
            <components>
                <component>com.speedment.enterprise.connectors.db2.Db2Bundle</component>
            </components>
            <parameters>
                <parameter>
                    <name>licenseKey</name>
                    <value>(YOUR LICENSE CODE)</value>
                </parameter>
            </parameters>
        </configuration>
    </plugin>

You also have to depend on the AS400 connector and JDBC connector as a runtime dependency for your application:

    <dependencies>
        <dependency>
            <groupId>net.sf.jt400</groupId>
            <artifactId>jt400-full</artifactId>
            <version>6.0</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            groupId>com.speedment.enterprise.connectors</groupId>
            <artifactId>db2-connector</artifactId>
            <version>${speedment.enterprise.version}</version>
        </dependency>
        <dependency>
            <groupId>com.speedment.enterprise</groupId>
            <artifactId>runtime</artifactId>
            <version>${speedment.enterprise.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>

AS400 Application

When you build the application, the Db2Bundle needs to be added to the runtime like this:

    YourApplication app = new YourApplicationBuilder()
        .withPassword("your-dbms-password")
        .withParam("licenseKey", "(YOUR LICENSE CODE)")
        .withBundle(Db2Bundle.class)
        .build();

The Db2Bundle supports both DB2 and AS400.

{% include tip.html content= " The AS400 JDBC driver has some features that can be controlled using the connection URL. To activate these functions, use the method ApplicationBuilder::withConnectionUrl to specify a custom connection URL. " %}

{% include note.html content= " The JDBC driver version above is the one officially supported by Speedment. Other JDBC versions may also work. " %}

{% include prev_next.html %}

Discussion

Join the discussion in the comment field below or on Gitter

{% include messenger.html page-url="connectors.html" %}