Skip to content

Commit

Permalink
Merge branch '3.8' of https://github.com/JumpMind/symmetric-ds.git in…
Browse files Browse the repository at this point in the history
…to 3.8
  • Loading branch information
gregwilmer committed Sep 14, 2017
2 parents fc5db8e + b94af47 commit a818175
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 11 deletions.
20 changes: 19 additions & 1 deletion symmetric-assemble/src/asciidoc/appendix/databases.ad
Expand Up @@ -208,7 +208,15 @@ by database.
|Y
|Y
|Y


|Tibero
|6 and above
|Y
|Y
|Y
|Y
|Y
|Y
|====


Expand Down Expand Up @@ -381,6 +389,15 @@ When locating a table, SymmetricDS uses the default catalog and schema unless th
|
|Y
|select current_schema()


|Tibero
|
|N
|
|Y
|select sys_context('USERENV', 'CURRENT_SCHEMA') from dual

|===

include::ignite.ad[]
Expand All @@ -403,3 +420,4 @@ include::sqllite.ad[]
include::sybase-ase.ad[]
include::redshift.ad[]
include::sqlite.ad[]
include::tibero.ad[]
70 changes: 65 additions & 5 deletions symmetric-assemble/src/asciidoc/appendix/db2.ad
Expand Up @@ -49,16 +49,76 @@ CREATE SYSTEM TEMPORARY TABLESPACE tmp_tbsp
|===

=== DB2 for IBM i
The DB2 for IBM i dialect is for connecting to a database on IBM iSeries (AS/400) machines. It was tested with the
http://jt400.sourceforge.net/[jt400 JDBC driver]. The "libraries" property is used in the JDBC URL
to set the default schema.
The DB2 for IBM i dialect can connect to a database on IBM iSeries (AS/400) machines. It was tested with the
http://jt400.sourceforge.net/[jt400 JDBC driver], which is already included in the SymmetricDS download.
Here is an example JDBC URL:

----
jdbc:as400://hostname/myschema
----

The "libraries" parameter may be used in some cases to resolve unqualified object names:

----
jdbc:as400://hostname/;libraries=myschema
----

WARNING: Note that if the library is not configured to auto journal resources, then all tables need to be journaled. A library will be auto journaled
if it is created using the `CREATE SCHEMA` or `CREATE COLLECTION` SQL commands.
WARNING: The tables created by SymmetricDS must have journaling enabled for commitment control.

==== Auto Journaling

The SymmetricDS library will be automatically journaled if it is created using the `CREATE SCHEMA` or `CREATE COLLECTION` SQL commands.

Otherwise, journaling can be enabled for new tables automatically by creating a default journal named `QSQJRN` in the library.
The following steps add automatic journaling to the "sym" library (change it to your library) using the OS/400 command line:

* Create the journal receiver object:

----
CRTJRNRCV JRNRCV(sym/symjrnrcv)
----

* Create the journal object:

----
CRTJRN JRN(sym/QSQJRN) JRNRCV(sym/symjrnrcv)
----


==== Manual Journaling

Using automatic journaling for the SymmetricDS library is the preferred method, but journaling can also
be enabled for each table manually.
After starting SymmetricDS for the first time, it will connect to the database and create the required tables.
Then it will log an error message that journaling needs to be enabled for its tables.
The following steps add journaling to the "sym" library (change it to your library) using the OS/400 command line:

* Create a journal receiver object:
----
CRTJRNRCV JRNRCV(sym/symjrnrcv)
----

* Create a journal object:
----
CRTJRN JRN(sym/symjrn) JRNRCV(sym/symjrnrcv)
----

* Start journaling:
----
STRJRNPF FILE(sym/SYM_C00001) JRN(sym/symjrn)
----

This step needs to be repeated for each physical file (table) created by SymmetricDS.
A single command can be run for all tables at once, like this:

----
CALL QCMD
<hit F11 for more lines>

STRJRNPF FILE(sym/SYM_C00001 sym/SYM_C00002 sym/SYM_C00003 sym/SYM_C00004 sym/SYM_C00005 sym/SYM_C00006 sym/SYM_D00001 sym/SYM_D00002 sym/SYM_DATA sym/SYM_E00001 sym/SYM_E00002 sym/SYM_F00001 sym/SYM_F00002 sym/SYM_F00003 sym/SYM_F00004 sym/SYM_G00001 sym/SYM_G00002 sym/SYM_I00005 sym/SYM_I00008 sym/SYM_L00001 sym/SYM_LOCK sym/SYM_M00001 sym/SYM_M00002 sym/SYM_N00001 sym/SYM_N00002 sym/SYM_N00003 sym/SYM_N00004 sym/SYM_N00005 sym/SYM_N00006 sym/SYM_N00007 sym/SYM_N00008 sym/SYM_N00009 sym/SYM_N00010 sym/SYM_N00011 sym/SYM_N00012 sym/SYM_NODE sym/SYM_O00001 sym/SYM_P00001 sym/SYM_R00001 sym/SYM_R00002 sym/SYM_ROUTER sym/SYM_S00001 sym/SYM_T00001 sym/SYM_T00002 sym/SYM_T00003 sym/SYM_T00004 sym/SYM_T00005 sym/SYM_T00006 sym/SYM_T00007) JRN(sym/symjrn)
----



.Supported Data Types
|===
Expand Down
14 changes: 14 additions & 0 deletions symmetric-assemble/src/asciidoc/appendix/tibero.ad
@@ -0,0 +1,14 @@

=== Tibero
This section describes Tibero specific SymmetricDS details.

==== Database Permissions
The SymmetricDS database user generally needs privileges for connecting and creating tables (including indexes), triggers, sequences,
and procedures (including packages and functions). The following is an example of the needed grant statements:

[source, SQL]
GRANT CONNECT TO SYMMETRIC;
GRANT RESOURCE TO SYMMETRIC;
GRANT CREATE ANY TRIGGER TO SYMMETRIC;
GRANT EXECUTE ON UTL_RAW TO SYMMETRIC;

4 changes: 3 additions & 1 deletion symmetric-assemble/src/asciidoc/configuration/license-key.ad
Expand Up @@ -6,10 +6,12 @@ The user is prompted automatically to enter a valid license if one is missing, o
The license key contains a group of fields to define how the software is licensed for use.

License Info:: A description of the license type.
Holder:: The company name of the license holder.
Holder:: The company name or email address of the license holder.
Effective Date:: Date and time when the license will become valid.
Expiration Date:: Date and time when the license will no longer be valid.
Max Nodes:: The maximum number of nodes that can be created for synchronization.
Max Tables:: The maximum number of table triggers that can be created for synchronization.
Max Rows:: The maximum number of rows that can be synchronized in a 24-hour period.
Max Maintenance:: The end date and time for maintenance and support. Defaults to expiration date if not present.

The license key is a block of encoded text that is sent to the user over email, or it can be retrieved from the
Expand Down
Expand Up @@ -61,7 +61,7 @@ public void disableSyncTriggers(ISqlTransaction transaction, String nodeId) {

@Override
public String getSyncTriggersExpression() {
return supportsGlobalVariables ? super.getSyncTriggersExpression() : "";
return supportsGlobalVariables ? super.getSyncTriggersExpression() : "1=1";
}

@Override
Expand Down
Expand Up @@ -26,6 +26,7 @@
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -453,7 +454,17 @@ public void setupDatabase(boolean force) {
} else {
log.info("SymmetricDS is not configured to auto-create the database");
}
configurationService.initDefaultChannels();
try {
configurationService.initDefaultChannels();
} catch (SqlException e) {
if (e.getCause() instanceof SQLException) {
SQLException se = (SQLException) e.getCause();
if (se.getErrorCode() == -7008 && se.getSQLState().equals("55019")) {
log.error("Please enable journaling on SYM objects. For instructions, see the appendix in the User Guide on DB2 for i.");
}
}
throw e;
}
clusterService.init();
sequenceService.init();
autoConfigRegistrationServer();
Expand Down
Expand Up @@ -3,6 +3,13 @@
import javax.sql.DataSource;

import org.apache.commons.lang.StringUtils;
import org.jumpmind.db.model.Database;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.platform.PermissionResult;
import org.jumpmind.db.platform.PermissionResult.Status;
import org.jumpmind.db.platform.PermissionType;
import org.jumpmind.db.sql.ISqlTransaction;
import org.jumpmind.db.sql.SqlException;
import org.jumpmind.db.sql.SqlTemplateSettings;

public class Db2As400DatabasePlatform extends Db2DatabasePlatform {
Expand Down Expand Up @@ -38,8 +45,41 @@ public String getDefaultSchema() {

@Override
public String getDefaultCatalog() {
// This must return null for AS400, an empty string will return no match on readTable meta data.
return null;
// This must return null for AS400, an empty string will return no match on readTable meta data.
return null;
}

@Override
protected PermissionResult getCreateSymTablePermission(Database database) {
Table table = getPermissionTableDefinition();

PermissionResult result = new PermissionResult(PermissionType.CREATE_TABLE, Status.FAIL);
getDropSymTablePermission();

try {
database.addTable(table);
createDatabase(database, false, false);

ISqlTransaction tran = null;
try {
tran = sqlTemplate.startSqlTransaction();
tran.prepareAndExecute("insert into " + table.getName() + " values (?, ?)", 1, 0);
result.setStatus(Status.PASS);
} catch (SqlException e) {
result.setException(e);
result.setSolution("Enable automatic journaling on library");
} finally {
if (tran != null) {
tran.rollback();
tran.close();
}
}
} catch (SqlException e) {
result.setException(e);
result.setSolution("Grant CREATE permission");
}

return result;
}

}
1 change: 1 addition & 0 deletions symmetric-server/src/main/deploy/bin/setenv
Expand Up @@ -37,6 +37,7 @@ SYM_OPTIONS="-Dfile.encoding=utf-8 \
-Dsun.net.client.defaultReadTimeout=300000 \
-Dsun.net.client.defaultConnectTimeout=300000 \
-Djava.net.preferIPv4Stack=true \
-Dcom.ibm.as400.access.AS400.guiAvailable=false \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=$SYM_HOME/tmp"
export SYM_OPTIONS
Expand Down
1 change: 1 addition & 0 deletions symmetric-server/src/main/deploy/bin/setenv.bat
Expand Up @@ -38,6 +38,7 @@ set SYM_OPTIONS=-Dfile.encoding=utf-8 ^
-Dsun.net.client.defaultReadTimeout=300000 ^
-Dsun.net.client.defaultConnectTimeout=300000 ^
-Djava.net.preferIPv4Stack=true ^
-Dcom.ibm.as400.access.AS400.guiAvailable=false ^
-XX:+HeapDumpOnOutOfMemoryError ^
-XX:HeapDumpPath="%SYM_HOME%\tmp"

Expand Down
1 change: 1 addition & 0 deletions symmetric-server/src/main/deploy/conf/sym_service.conf
Expand Up @@ -32,6 +32,7 @@ wrapper.java.additional.15=-Dcom.sun.management.jmxremote.port=31418
wrapper.java.additional.16=-Dcom.sun.management.jmxremote.rmi.port=31418
wrapper.java.additional.17=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.18=-Djava.rmi.server.hostname=localhost
wrapper.java.additional.19=-Dcom.ibm.as400.access.AS400.guiAvailable=false

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=256
Expand Down

0 comments on commit a818175

Please sign in to comment.