GoldenGate: Java Adapter

Install

Overview

* Install JDK 1.5 or later
* Install GoldenGate 10.0.0.4 or later
* Install Java Adapter

Install Java

* Install JDK 1.5 or later.
* Set env variables.
Windows:

set JAVA_HOME=C:\prog\java\jdk1.6.0_18
set PATH=%JAVA_HOME%\bin;%PATH%
set PATH=%JAVA_HOME%\jre\bin\server;%PATH%

Unix:

export JAVA_HOME=/opt/jdk1.6
export PATH=${JAVA_HOME}/bin:${PATH}
export LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/i386/server:${LD_LIBRARY_PATH}

Install GoldenGate

* Install GoldenGate 10.0.0.4 or later.
* See Windows Install or Unix Install for details.
* Prepare database.
* Prepare tables.
* Setup primary capture on database server.
* Setup data pump on database server.

Install Java Adapter

* Unzip Java adapter zip file (e.g. V18191-01.zip) into GoldenGate installation directory.

Configure Java Adapter

* Overview:
Create Data Pump
-> Edit Params to point to user exit config file and java user exit config file
-> Configure user exit
-> Configure Java user exit
* Configure a data pump to run the user exit

ADD EXTRACT u_gt, EXTTRAILSOURCE ./dirdat/gt

* Configure u_gt parameters

edit params u_gt
# User exit extract process name
Extract u_gt
 
# Set user exit config file
SetEnv ( GGS_USEREXIT_CONF = "dirprm/cuserexit.properties" )
 
# Set java config file
SetEnv ( GGS_JAVAUSEREXIT_CONF = "dirprm/javaue.properties" )
 
# Set source definition file
SourceDefs ./dirdef/gg_test.def
 
# Print some debugging info
getEnv (JAVA_HOME)
getEnv (LD_LIBRARY_PATH)
getEnv (LIBPATH)
getEnv (PATH)
 
# Run user exit command
CUserExit ./JavaUserExit.dll CUSEREXIT PASSTHRU INCLUDEUPDATEBEFORES
 
Table gg_src.*;

* Copy ‘cuserexit.properties’ from ‘javaue\docs\sample-dirprm’ directory to ‘dirprm’ directory.
* Copy ‘log4j.properties’ from ‘javaue\resources\classes’ directory to Goldengate root directory.
* Edit ‘cuserexit.properties’

goldengate.userexit.chkptprefix=JAVAUE_
goldengate.userexit.nochkpt=TRUE
goldengate.userexit.timestamp=utc
 
# Setup logging
goldengate.log.modules=GENUSEREXIT,LOGMALLOC,JAVAWRITER
#goldengate.log.level=INFO
goldengate.log.level=DEBUG
goldengate.log.level.LOGMALLOC=ERROR
goldengate.log.tostdout=false
goldengate.log.tofile=true
goldengate.log.logname=cuserexit
 
# Setup javawriter
goldengate.userexit.writers=javawriter
javawriter.stats.time=600
javawriter.stats.numrecs=100
javawriter.stats.display=TRUE
javawriter.stats.full=TRUE
javawriter.bootoptions=-Djava.class.path=javaue/ggue.jar -Dlog4j.configuration=log4j.properties -Xmx512m -Xms256m

* Copy ‘javaue.properties’ from ‘javaue\docs\sample-dirprm’ directory to ‘dirprm’ directory.
* Edit ‘javaue.properties’

# Java application properties for JMS lab using ActiveMQ as JMS server
 
# the handlerlist defines which handlers are active
gg.handlerlist=one,two
 
# the first handler is just a single file
gg.handler.one.type=singlefile
gg.handler.one.format=xml
gg.handler.one.file=output.xml
 
gg.handler.two.type=singlefile
gg.handler.two.format=/dirprm/sample_tx.vm
gg.handler.two.file=output.txt

* Copy ‘sample_tx.vm’ to ‘dirprm’ directory.
* Generate definition file
– Setup definition parameter file in the dirprm directory with the following content:

-- Use GGSCI>edit params gg_test
DEFSFILE C:\goldengate\dirdef\gg_test.def
USERID gg_src, PASSWORD password
TABLE gg_src.*;

– Run dos command from GoldenGate installation directory (e.g. c:\goldengate)

defgen paramfile dirprm/gg_test.prm

– gg_test.def will be generated in \dirdef directory.

Start Extract u_gt

start extract u_gt
view report u_gt

Insert Data to Source Table

INSERT INTO GG_SRC.gg_test VALUES ('10','Ten');
commit;

Check output.txt

Transaction: numOps=1 (buffer=1) ts='2010-05-08 03:12:11.000000' 
 Operation (seq=3/rba=1388 [W]): INSERT (INSERT) on table "GG_SRC.GG_TEST":
    GG_SRC.GG_TEST, (key=true) ID = "10"
    GG_SRC.GG_TEST, (key=false) NAME = "Ten"
This entry was posted in goldengate. Bookmark the permalink.

One Response to GoldenGate: Java Adapter

  1. Pingback: Informasi Online Perkumpulan Orang Jawa Kelahiran di Sumatera

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.