Objectivity/DB and JAVA


Last Update: 11th May 1999

Objectivity/Java

Objectivity 5.1/JAVA supports NT and Solaris platforms. 

Objectivity for Java requires that you have access to following software:

Objectivity for Java will be installed on the installDir that you specified.

Add the Objectivity for Java library path:

CLASSPATH installDir\lib\oojava.jar
Note: some application development environments such as Visual J++ or Visual Cafe require you to specify CLASSPATH from within the tool.

Access from NICE

Access from Solaris

Running the Examples

NOTE: if you are using JDK 1.2betaX you have to set the THREADS_FLAG environment variable to native. Objectivity/Java is not working with green threads, it works with Solaris native threads. If you can not compile even with the native flag set, you may need to install patches needed to use Native Threads on Solaris 2.5.1.  On Solaris (SPARCTM Platform Edition), the required patches are 103566-08 and 103640-08. On Solaris (Intel Platform Edition), the required patches are 104241-0 and 103641-08.

Run an example to see that the JAVA installation is fine

Note: Make sure that the path to JDK and Objectivity class library for Java are set properly.

1.Compile the files Vehicle.java , Fleet.java , VrcInit.java , and Vrc.java located in the GettingStarted subdirectory of the programming samples directory (d:\objy51\docs\java\samples\GettingStarted).

	javac VrcInit.java
	javac Vrc.java
Note: you may get the error:
	SIGSEGV 11* segmentation violation 
	si_signo [11]:SIGSEGV 11*segmentation violation
	si_errno [0]: Error 0
	si_code [1]: SEGV_MAPERR [addr: 0xad7ae2bc]
	stackbase=EFFFE9A0, stackpointer=EFFFE6E0

Objectivity for java in Solaris uses the system native threads, while the java virtual machine, by default, starts using green threads. To specify to the virtual machine that you want to use native threads, you should specify following flag:

	java - YourClass

The bytecodes will be generated and stored on the .class files. In GettingStarted directory you will have following files :

	Fleet.class
	Fleet.java
	Vehicle.class
	Vehicle.java
	Vrc.class
	Vrc.java
	VrcInit.class
	VrcInit.java
2.Start an Objectivity/DB lockserver in your system,
	d:\installDir\java\samples\GettingStarted\oolockserver
3.Create a federated database called Vrc in the GettingStarted sample directory.
	d:\installDir\java\samples\GettingStarted\oonewfd -fdfilepath
	d:\objy51\docs\java\samples\GettingStarted\Vrc.fdb -lockserverhost  Vrc
The output will be:
	Objectivity/DB (TM) Create Federated Database Utility, Version
	5.1 Build:  58
	Copyright (c) Objectivity, Inc 1993, 1998. All rights reserved.
	Federated Database "Vrc" created.
You can check the catalog of the federated database  if  everything is right :
	d:\objy51\docs\java\samples\GettingStarted>oodumpcatalog Vrc
	Objectivity/DB (TM) List Database Files Utility, Version 5.1 Build:
	58
	Copyright (c) Objectivity, Inc 1990, 1998. All rights reserved.

	FD Name = Vrc
	FD ID = 1
	FD File = pc-01::D:\objy50\docs\java\samples\GettingStarted\Vrc.fdb
	Boot File = pc-01::D:\objy50\docs\java\samples\GettingStarted\Vrc
	Jnl Dir = pc-01::D:\objy50\docs\java\samples\GettingStarted
	Lock Host = pc-01
4.Execute VrcInit to initialize the federated database. 
	d:\installDir\java\samples\GettingStarted\java VrcInit
	When you execute VrcInit , the output will be:

	Created database
	"VehiclesDB".
	Created container "VehiclesContainer".
	Added vehicle: License:CA1234 Class:G Doors:4
	MANUAL Rate:40
	Added vehicle: License:CA7654 Class:H Doors:4
	AUTOMATIC Rate:40
Note: You can find more information about this example in the "Getting Started" chapter of the Objectivity for Java doucmentation. You will find other examples as indicated in the "Programming Examples" chapter. 5.Use oobrowse (in NT) or ootoolmgr (in UNIX) to browse  the database VehiclesDB. 
	d:\installDir\java\samples\GettingStarted\oobrowse Vrc

Eva.Arderiu@cern.ch