Search This Blog

Wednesday, February 22, 2012

JVM COBOL within Apache Tomcat

After installing the micro focus product , we needed to use the Java to Cobol calls.
our java code is running within tomcat 5.5.X via JVM 5.
using microfoucus jar files is not enoght  .. i get the next error

Micro Focus COBOL Runtime Support for Java is preventing this application from executing because an internal Java property is not setup. Reason: Application should use "cobjrun" to execute this application instead of the default "java" trigger

i knew that i need to use cobjrun as my running process and not just java runtime.
based on this article Running JVM COBOL within Apache Tomcat: i started .
in the end i managed to make such call.
the only changes i needed are:

in the file setclasspath.sh .. i changed the _RUNJAVA env .
_RUNJAVA=/opt/microfocus/cobol/bin/cobjrun32

in the file catalina.sh  i add the next env settings

#yaniv add
COBDIR=/opt/microfocus/cobol/
COBJVM=sun_150
LD_LIBRARY_PATH=/opt/microfocus/cobol/lib/:/usr/java/jre/lib/sparc:/usr/java/jre/lib/sparc/client:/usr/java/jre/lib/sparc/native_threads:$LD_LIBRARY_PATH
PATH=/opt/microfocus/cobol/lib/:/usr/java/jre/sh:/usr/java/sh:/usr/java/bin:/usr/java/jre/bin:$PATH
CLASSPATH=/opt/microfocus/cobol/lib/mfcobol.jar:.:/usr/java/jre/lib/rt.jar:/opt/microfocus/cobol/lib/mfimtk.jar:/opt/microfocus/cobol/lib/xerces.jar:/opt/microfocus/cobol/lib/castor-0_9_4_1-xml.jar:/opt/microfocus/cobol/lib/mfcobol.jar:.:/usr/java/jre/lib/rt.jar:/opt/
COBCPY=/opt/microfocus/cobol/cpylib:$COBCPY
export COBDIR
export COBJVM
export LD_LIBRARY_PATH
export PATH
export CLASSPATH
export COBCPY

restart your tomcat .. and enjoy
Yaniv Tzanany

Configure Putty with Xming

very good instruction could be found here

Using PuTTY and Xming for X11 Forwarding


in case of failure such
Xlib: connection to "10.11.197.11:0.0" refused by server
Xlib: No protocol specified

try to run xming
Xming.exe -ac  


should help ... 


enjoy 
Yaniv Tzanany
 

Tuesday, February 21, 2012

Creating Top Down Web Service via Apache Axis2

This tutorial is meant to demonstrate the use of the newly introduced Axis2 Web Services tools in the Web Tools Platform Project using the WTP 2.0 drivers. Also this tutorial shows how to create a simple top-down Web service from a WSDL file and test that with the WSE (Web Service Explorer). The WSDL file in this scenario calculates the area of an rectangle and its the same WSDL that used in the Axis web services tutorials.

old ... but do the job

Creating Top Down Web Service via Apache Axis2

Monday, February 6, 2012

Setting the applicationOriginData on MQMessage

the applicationOriginData on MQMessage java class , is a great way to add some app extra info on the message.
"This is information that is defined by the application suite, and can be used to provide additional information about the origin of the message."

In addition to add such data you must open the queue with the next option:
MQC.MQPMO_SET_ALL_CONTEXT


and when put the message add the same option above  on the MQPutMessageOptions.
this is the only way i managed to add such info on the message.


enjoy
Yaniv Tzanany

Sunday, February 5, 2012

SQLite with VC++

In case you are looking for sqlite3.lib , you can create it via the next command .


create lib file from def file
lib /def:sqlite3.def /OUT:sqlite3.lib
more details could be found in this post create-lib-file-from-dll.


check out the wrapper class i found , very easy to use and to implement CppSQLite - C++ Wrapper for SQLite.


Check out example1 in this article  Loading and Saving In-Memory Databases  we loading and saving the contents of an in-memory database to a file on disk , very common in the real world.


i extend the cppSQLite , to enable to read DB from disk into memory


void CppSQLite3DB::open(const char* szFile,BOOL inMem)
{
if(inMem)
{
open(":memory:");
loadOrSaveDb(mpDB,szFile,false);
}
else
open(szFile);
}

Yaniv Tzanany


Wednesday, February 1, 2012

SQLite - starter kick

SQlite , its very popular Database , easy to use , i used it as InMemory db.

download software from Sqlite home page.

know your limits -> Frequently Asked Questions .

Know your Datatypes In SQLite Version 3.

Command Line Shell For SQLite.

in case you need ODBC for sqlite , you can find it here SQLite ODBC Driver.
nice tool for sqlite its the sqlite browser.
check out Sqlite wrappers you might find something for your needs.

(i used the 3.7.10 version)
command line usage example to open db

sqlite3.exe yaniv.db
sqlite> .mode column
sqlite> .headers  on
sqlite> select * from t1;


Create a new db (open cmd window)
sqlite3.exe myTest.db
sqlite> CREATE TABLE t2(t  TEXT,nu NUMERIC,i  INTEGER,r  REAL,no BLOB ,EFFEC_DATE DATE );
sqlite> INSERT INTO t2 (t,nu,i,r,no,EFFEC_DATE) VALUES('500.0', '500.0', '500.0', '500.0', '500.0','2010-10-23');
sqlite>.quit


.read excute sql file
import value into db

sqlite>.separator ,
sqlite>.import  dd.txt t2

// will show you all master objects
sqlite> SELECT * FROM sqlite_master;


enjoy 
yaniv Tzanany