Hi All
Please ignore all the previous replies by me.
Now I am able to connect to CMOD and here is what all i have done.
System variables :CLASSPATH - .;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;C:\PROGRA~1\IBM\SQLLIB\bin;C:\PROGRA~1\IBM\SQLLIB\java\common.jar;D:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;D:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;D:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;D:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;D:\PROGRA~1\IBM\SQLLIB\bin;D:\PROGRA~1\IBM\SQLLIB\java\common.jar;D:\Program Files\IBM\OnDemand Web Enablement Kit\api\ODApi.jar
DB2INSTANCE - DB2
LIB - C:\PROGRA~1\IBM\SQLLIB\LIB;D:\PROGRA~1\IBM\SQLLIB\LIB
Path - %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Windows Imaging\;C:\Program Files\MySQL\MySQL Server 5.0\bin;D:\113239\live\Apache-ant-1.6.5\bin;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;D:\PROGRA~1\IBM\SQLLIB\BIN;D:\PROGRA~1\IBM\SQLLIB\FUNCTION;D:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;D:\IBM\DLLS;
Note that you have to only edit the Path and the CLASSPATH variables.
I have included the others just for your information.
_________________________________________________________________________________
This code has comments embedded about the errors I was getting previously and their solutions.
Please read through.
Java code :import java.util.*;
import java.io.*;
import com.ibm.edms.od.*;
public class Test
{
public static void main (String argv[])
{
int rc;
int numFolders;
byte[] data;
String[] displayList;
FileOutputStream file;
ODServer odServer;
ODConfig odConfig;
ODFolder odFolder;
ODCriteria odCrit;
Vector hits;
ODHit odHit;
Vector notes;
Date before, after;
Date program_start, program_end;
String path = "D:/Program Files/IBM/OnDemand Web Enablement Kit/arswww.ini";
/*System.setProperty("java.library.path", "d:\\IBM\\DLLS;");
System.load("d:\\IBM\\DLLS\\icudt36.dll");
System.load("d:\\IBM\\DLLS\\icuuc36.dll");
System.load("d:\\IBM\\DLLS\\arssck32.dll");
System.load("d:\\IBM\\DLLS\\arsxapi.dll");
System.load("d:\\IBM\\DLLS\\icuin36.dll");
System.load("d:\\IBM\\DLLS\\ctreestd.dll");
System.load("d:\\IBM\\DLLS\\ars3wapi32.dll");
System.load("d:\\IBM\\DLLS\\arswwwsl32.dll");*/
System.out.println("init....");
int portNumber;
Properties ODWEKProperties = new Properties();
try {
ODWEKProperties.load(new FileInputStream("ODWEK.properties"));
System.out.println(ODWEKProperties.getProperty("Afp2PdfConfigFile"));
String appletDir = ODWEKProperties.getProperty("AppletDir");
String tempDir = ODWEKProperties.getProperty("TempDir");
String traceDir = ODWEKProperties.getProperty("TraceDir");
String serverName = ODWEKProperties.getProperty("server");
String userId = ODWEKProperties.getProperty("userid");
String password = ODWEKProperties.getProperty("password");
/*
* [Pankaj]
* bug 1: AppletDir property Error
* cause: additional parameter in _ctor of ODConfig
* solution: additional parameter removed.
* status: fixed
*/
odConfig = new ODConfig(
ODWEKProperties.getProperty("AfpViewer"), // AfpViewer
ODWEKProperties.getProperty("LineViewer"), // LineViewer
ODWEKProperties.getProperty("MetaViewer"), // MetaViewer
Long.parseLong(ODWEKProperties.getProperty("MaxHits")), // MaxHits
ODWEKProperties.getProperty("AppletDir"), // AppletDir
ODWEKProperties.getProperty("Language"), // Language
ODWEKProperties.getProperty("TempDir"), // TempDir
ODWEKProperties.getProperty("TraceDir"), // TraceDir
Integer.parseInt(ODWEKProperties.getProperty("TraceLevel")) // trace
);
odServer = null;
try{
odServer = new ODServer(odConfig);
}
catch(Throwable e){
e.printStackTrace();
}
/*
* [Pankaj]
* bug 2: java.lang.UnsatisfiedLinkError, ars3wapi32.dll not loaded
* cause: Environment variable PATH value for DLL location was not correct, it was set to "D:\IBM\DLLLs\*.DLL;"
* instead of "D:\IBM\DLLs;". i.e spelling mistake and path should be a directory
* solution: path corrected
* status: fixed
* refer:
http://www-01.ibm.com/support/docview.wss?uid=swg21430283 */
if (odServer == null){
System.out.println("ODServer instance could not be created, exiting.");
return;
}
odServer.setServerName(serverName);
odServer.initialize("CitarController");
odServer.setUserId(userId);
odServer.setPassword(password);
odServer.logon();
System.out.println("Server Name: " + odServer.getServerName());
System.out.println("User Id: " + odServer.getUserId());
System.out.println("Password: " + odServer.getPassword());
portNumber = odServer.getPort();
System.out.println("Setting port to " + portNumber + "...");
odServer.setPort(portNumber);
System.out.println("Port: " + portNumber);
/*
* additional code starts - Pankaj
*/
System.out.println("\nGetting no. of folders..");
System.out.println("No. of Folders: "+odServer.getNumFolders());
System.out.println("\nPrinting folder details..\n");
// get all available folders
//(**) forcing java 1.5 generic, API says, it returns enum of ODFolder type
Enumeration<ODFolder> folders = odServer.getFolders();
// get folder details
while ( folders.hasMoreElements() ){
ODFolder odf = folders.nextElement(); // no type casts now, refer (**) above
System.out.println("Name: "+odf.getName());
System.out.println("Description: "+odf.getDescription());
System.out.println("MaxHits: "+odf.getMaxHits());
System.out.println("NumApplGroups: "+odf.getNumApplGroups());
//System.out.println("ApplGroupNames: "+odf.getApplGroupNames());
System.out.println("SearchMessage: "+odf.getSearchMessage());
System.out.println("\n-----------------");
}
/*
* additional code ends - Pankaj
*/
//TODO: continue with new code..
// queryFolder(odServer);
} catch (ODException e) {
System.out.println("ODException: " + e);
System.out.println(" id = " + e.getErrorId());
System.out.println(" msg = " + e.getErrorMsg());
e.printStackTrace();
} catch (Exception e2) {
System.out.println("exception: " + e2);
e2.printStackTrace();
} catch (Throwable th) {
th.printStackTrace();
}
}
}
__________________________________________________________________________
ODWEK properties file :
#--------------------------
# Windows ODWEK Properties
#---------------------------
AfpViewer=pdf
LineViewer=applet
MetaViewer=
MaxHits=500
AppletDir=/applets
Language=ENU
TempDir=c\:\\temp
TraceDir=c\:\\temp
TraceLevel=4
server=10.224.203.56
#server=punib14711
userid=admin
password=password
Afp2PdfConfigFile=D\:\\Program Files\\IBM\\OnDemand Web Enablement Kit\\afp2pdf.ini
Afp2PdfInstallDir=D\:\\Program Files\\IBM\\OnDemand Web Enablement Kit
_______________________________________________________________________________
I hope this is helpful to everyone who is beginning with ODWEK.
Cheers
Pankaj.