| Home | About FairCom | Products | Support | Sales | Contact Info | Site Map | Download | Newsletter |

Company Overview
History
Our Customers
Success Stories
Contact Information
Why FairCom
FairCom Logos
Press Releases
Customer Quotes
Site Map
Read the Dr. Dobb's Journal article on cross-platform database Programming
Read HP WORLD's article on the c-tree Server
Read the Linux Journal review on c-tree Plus
FairCom Brochure
 
 

Leverage the Power of Java in your c-treeSQL Server Environment

The Java programming language is a powerful, convenient, and cross-platform development environment. Easy to use and widely available, it has become a productive choice for many programming applications. Its included database connectivity via JDBC, and multitudes of sophisticated built-in objects give you unparalleled options.

The c-treeSQL Server supports full Java JDBC access to your data. A Type IV JDBC Driver, completely written in Java, is included with every c-treeSQL Server, and can be freely distributed with each licensed production c-treeSQL installation.

The c-treeSQL Server Java Edition offers you advanced SQL capabilities of Stored Procedures, Triggers, and User Defined Functions. The c-treeSQL Server Java Edition is an extension of the c-treeSQL Server that can take advantage of your Java runtime environment. When installed in a proper Java environment and configured with a few simple settings, you can immediately begin using Stored Procedures , Triggers and the Version 8.14 New c-treeSQL User Defined Functions in your c-treeSQL applications.

Java Environment Setup

c-treeSQL's implementation of stored procedures, triggers, and user defined functions allows use of standard Java programming constructs instead of requiring proprietary flow-control language. Developers already familiar with the Java programming language will thus find them easy to implement, without needing to learn a new programming paradigm.

You will need the c-treeSQL Server Java Edition Version 8.14 for the Java functionality needed with Stored Procedures, Triggers and User Defined Functions (UDFs). In addition, it is required to have the Java JVM run-time engine, and additionally, the Java SDK to create Java functions. FairCom does not provide the Java SDK or the Java JVM run-time engine. These will need to be installed by the application vendor as part of the installation process, or by the end user.

FairCom recommends the Sun Java SDK 1.4.2 for the best performance and stability with c-treeSQL Server Java Edition V8.14. Be sure to follow the Java SDK installation instructions for your particular platform.

The c-treeSQL Server Java Edition interacts with Java in the following ways:

  • When you create a stored procedure, c-treeSQL processes the Java code, submits it to the Java compiler, and receives the compiled results to store in the database.
  • When applications call a stored procedure, c-treeSQL interacts with the Java virtual machine to execute the stored procedure and receive any results.

To enable the c-treeSQL Server Java Edition to properly recognize the Java environment for Stored Procedures, Triggers, and UDF's requires editing the server configuration file, ctsrvr.cfg . This is a text file the server uses to configure various server options upon start-up and resides in the ctreeServers\ctreeJQLServer directory under the root of the FairCom installation directory.

Three files are required for proper execution of any Java function:

rt.jar and jvm.dll are Java SDK files supporting the Java runtime environment;

ctreeSQLSP.jar is a file supplied with the c-treeSQL Server which defines c-treeSQL classes available for your Java function.

javac.exe, the Java compiler, is required for submitting new Java code to the c-treeSQL Server.

For the Microsoft Windows platform, add or uncomment (to uncomment a line, remove the semicolon from the beginning of a line) the following lines, substituting the paths required for your Java installation:

SETENV   CLASSPATH=c:\j2sdk1.4.2\jre\lib\rt.jar;
         C:\FairCom\v8.14\ctreeServers\ctreeJQLServer\classes\ctreeSQLSP.jar
SETENV   JVM_LIB=c:\j2sdk1.4.2\jre\bin\server\jvm.dll
SETENV   JAVA_COMPILER=c:\j2sdk1.4.2\bin\javac.exe

These lines instruct the server about the Java environment in use, in particular the class location, the JVM path and the compiler to use.

c-treeSQL JDBC Setup

Beginning with Version 8.14, both the c-treeSQL Server and the c-treeSQL Server Java Edition support Java JDBC access. To enable c-treeSQL JDBC Driver access you need to configure your CLASSPATH environment variable to make sure the path for the Java 2 SDK is specified. As this is for client-side access, this needs to be done to your client environment settings. Add or modify the following path entries to your environment settings for the CLASSPATH

.;
C:\jdk1.4.2\jre\lib\rt.jar;
C:\FairCom\v8.14\ctreeSDK\ctreeJDBC\ctreeJDBC.jar

Make sure the first directory in your CLASSPATH environment variable is a ".", which represents the current directory.

The c-treeSQL JDBC Driver is available for both Microsoft Windows, and many Unix and Linux operating systems. You should set the environment settings appropriate for your platform.

Unix and Linux Considerations

The c-treeSQL Server Java Edition is available on many Unix and Linux platforms that also support a Java environment -- contact FairCom for details regarding availability for specific platforms. For these platforms only the SETENV CLASSPATH configuration keyword needs be set. The paths to the run-time JVM and Java compiler need to be in the path as seen by the server. You can use the LD_LIBRARY_PATH environment variable to set these in your server startup script.

Four paths should be set. For Linux with a standard Sun Java SDK installation, these are as follows.

/yourpath2java/jre/lib/i386/native_threads

/yourpath2java/jre/lib/i386/

/yourpath2java/jre/lib/i386/server

/yourpath2ctreejqlserver/lib

Other Unix installations will be similar. Consult the Java documentation specific to your platform for platform-dependent details.

These paths will correctly specify the Java JVM shared library, as well as the c-treeSQL Server Java Edition's shared library files. If you keep your LD_LIBRARY_PATH entries in a text file in your c-treeSQL Server Java Edition's directory, it may look as follows:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/yourpath2java/jre/lib/i386/native_threads:
   /yourpath2java/jre/lib/i386:/yourpath2java/jre/lib/i386/server:$PWD/lib

If this text file is then named ldpath , you can easily invoke the source command as follows:

>source ldpath

This action then sets your environment variables. You can examine the effect by issuing a set or export command and locate the LD_LIBRARY_PATH variable by examining the output.

Your PATH environment variable must contain the paths to the Java binaries to find the Java compiler, javac . If you have not already done so, the easiest way to do this is to append the PATH as follows:

>export PATH=$PATH/yourpath2java/bin:/yourpath2java/jre/bin

(Of course, this line could also be added to your ldpath text file, if you wanted to ensure that the path was set each time.)

Troubleshooting

If your server presents an error on startup, be sure to examine the message thoroughly, and also the contents of the CTSTATUS.FCS file generated. These messages will generally inform you of what was not correct in your environment. Most commonly, the path to the Java JVM cannot be found by the server. Re-check your LD_LIBRARY_PATH environment variables.

If you are having problems with stored procedures after the server is properly running, you may find messages in the sql_server.log file indicating that the javac compiler could not be found. Re-check your PATH environment variable for the correct path to the javac compiler.

Use the c-tree Administration Utility, ctadmn , or the c-tree Stop Utility, ctstop, to always properly shut down your server.

Click here for more information on Stored Procedures and Triggers.


 
The FairCom Server was chosen by Winnebago for its scalability and portability. The price and performance ratio was the best we found. Technical support has been very responsive.

Winnebago® Software Company

 
WEB COMMENTS
Copyright 2006 FairCom Corporation. All rights reserved.