| Oracle® TimesTen In-Memory Database TTClasses Guide Release 11.2.1 Part Number E13074-04 |
|
|
View PDF |
This chapter provides information to help you get started with your TTClasses development environment.
TTClasses comes compiled and preconfigured during TimesTen installation. If you have a different C++ runtime than what TTClasses was compiled with, recompile the library using the make (UNIX) or nmake (Microsoft Windows) utility.
The information here includes a discussion of how to set environment variables, a description of the compilation process, and an introduction to the Quick Start demo applications for TTClasses. The following topics are covered:
This section covers the following topics for setting up TTClasses in a UNIX environment:
To use TTClasses, ensure that your shell environment variables are set correctly. You can optionally source one of the following scripts or add a line to source one of these scripts in your login initialization script (.profile or .cshrc), where install_dir is the installation directory for your TimesTen instance:
install_dir/bin/ttenv.sh (sh/ksh/bash) install_dir/bin/ttenv.csh (csh/tcsh)
If you have application linking problems, which can be caused by using a different C++ runtime than what TTClasses was compiled with, recompile the library using the make utility.
To recompile TTClasses, change to the ttclasses directory, where install_dir is the installation directory for your TimesTen instance:
$ cd install_dir/ttclasses
Run make clean for a fresh start:
$ make clean
You can recompile TTClasses for both direct mode and client/server as follows:
$ make
Alternatively, to compile TTClasses for client/server only, use the MakefileCS Makefile:
$ make -f MakefileCS
The following "make target" options are available when you compile TTClasses in a UNIX environment:
all: Build a shared optimized library or libraries (default). When used with Makefile this can be for either direct mode or client/server. When used with MakefileCS this is for client/server only.
shared_opt: Build a shared optimized library. Currently this has the same effect as all.
To specify a make target, use the name of the make target on the command line.
For example, to build a shared debug version of TTClasses:
$ make clean $ make shared_debug
This section covers the following topics for setting up TTClasses in a Windows environment:
Note:
Installing TTClasses after compiling the TTClasses library happens automatically on Windows.Before recompiling, ensure that the PATH, INCLUDE, and LIB environment variables point to the correct Visual Studio directories. Execute the applicable Visual Studio C++ batch file (for example, VCVARS32.BAT or VSVARS32.BAT) to accomplish this.
Then set environment variables for TimesTen (if they were not already set during installation) by running the following:
install_dir\bin\ttenv.bat
If you have application linking problems, which can be caused by using a different C++ runtime than what TTClasses was compiled with, recompile the library using the nmake utility.
To recompile TTClasses, change to the ttclasses directory, where install_dir is the installation directory for your TimesTen instance:
install_dir\ttclasses
Run nmake clean for a fresh start:
install_dir\ttclasses> nmake clean
Then recompile. By default this is for both direct mode and client/server:
install_dir\ttclasses> nmake
The following "make target" options are available when you compile TTClasses in a Windows environment:
all: Build shared optimized libraries for direct mode and client/server (default).
client: Build shared optimized library for client/server only.
msdm: Build shared optimized library for Microsoft driver manager.
clean: Delete the TTClasses libraries and object files.
To specify a make target, use the name of the make target on the command line.
For example, to build only the client/server TTClasses library:
install_dir\ttclasses> nmake clean install_dir\ttclasses> nmake client
Most users do not need to manipulate the TTClasses Makefile. If you need to modify the TTClasses Makefile manually, you can add flags for the TTClasses compiler macros to the Makefile. For UNIX, add -Dflagname. For Windows, add /Dflagname.
This section includes information about the following compiler macros:
Flags for C++ I/O streams: TTC_USE_STRINGSTREAM, USE_OLD_CPP_STREAMS
TTDEBUG: Generate additional debugging and error checking logic
Also see "Platform-specific compiler macros".
There are multiple types of C++ streams and they are not compatible with each other. TimesTen provides two related flags. The types of streams you use in your application determine which flag to use, or whether you should use neither, as follows:
For relatively new (but not the newest) types of streams, where you are including <iostream> and using the ostrstream class, use neither flag. This is the default for most platforms and compilers.
For the newest types of streams, where you are including <iostream> and using the ostringstream class, use the TTC_USE_STRINGSTREAM flag.
For old types of streams, where you are including <iostream.h> and using the ostrstream class, use the USE_OLD_CPP_STREAMS flag. This is the default for some older platforms and compilers.
Check your TTClasses Makefile to see if either flag is set. If the flags are not set properly, then update the Makefile as appropriate, recompile TTClasses, and replace the previous TTClasses library file with the recompiled one.
Further information is provided in the subsections that follow.
As noted above, if you are using C++ I/O stream code where you are including <iostream> and using the ostrstream class, neither the TTC_USE_STRINGSTREAM flag nor the USE_OLD_CPP_STREAMS flag should be set. If either is set in the TTClasses Makefile, remove the line and recompile TTClasses.
This compiler flag is for use with C++ compilers that reliably support the newest C++ stream types and the ostringstream class. If your program uses the newest stream types, then TTClasses must be compiled with the -DTTC_USE_STRINGSTREAM setting. This allows TimesTen to use ostringstream and <iostream> for compatibility with your program code.
Also note that if your program uses the newest C++ streams, the USE_OLD_CPP_STREAMS flag must not be set. If the TTClasses Makefile has the wrong settings, correct them and recompile TTClasses.
Note:
Withgcc version 3.2 or higher, the TTC_USE_STRINGSTREAM flag is set by default in the file install_dir/include/ttclasses/TTIostream.h.This compiler flag is for older C++ compilers that do not support <iostream>. If your program uses old C++ streams, where you include <iostream.h> and use ostrstream, then TTClasses must be compiled with the -DUSE_OLD_CPP_STREAMS setting to be compatible with your program code.
Also note that if your program uses old C++ streams, the TTC_USE_STRINGSTREAM flag must not be set. If the TTClasses Makefile has the wrong settings, correct them and recompile TTClasses.
Compile TTClasses with -DTTDEBUG to generate extra debugging information. This extra information reduces performance somewhat, so use this flag only in development (not production) systems.
Compile TTClasses with -DTT_64BIT if you are writing a 64-bit TimesTen application.
Note that 64-bit TTClasses has been tested on AIX, HP-UX, Solaris, Red Hat Linux, and Tru64.
Be aware of the following limitations in TTClasses when you use an ODBC driver manager. (These restrictions do not apply to the demo ttdm driver manager supplied with the TimesTen Quick Start.)
XLA functionality does not work.
REF CURSOR functionality does not work.
The following methods of the TTCmd class do not work.
TTCmd::getColumn(int cno, SQLBIGINT* iP) TTCmd::getColumn(int cno, SQLTINYINT* iP) TTCmd::getColumn(int cno, SQLWCHAR** wcPP) TTCmd::getColumn(int cno, SQLWCHAR** wcPP, int* byteLenP) TTCmd::getColumnNullable(int cno, SQLBIGINT* iP) TTCmd::getColumnNullable(int cno, SQLTINYINT* iP) TTCmd::getColumnNullable(int cno, SQLWCHAR** wcPP) TTCmd::getColumnNullable(int cno, SQLWCHAR** wcPP, int* byteLenP) TTCmd::getNextColumn(SQLBIGINT* iP) TTCmd::getNextColumn(SQLTINYINT* iP) TTCmd::getNextColumn(SQLWCHAR** wcPP) TTCmd::getNextColumn(SQLWCHAR** wcPP, int* byteLenP) TTCmd::getNextColumnNullable(SQLBIGINT* iP) TTCmd::getNextColumnNullable(SQLTINYINT* iP) TTCmd::getNextColumnNullable(SQLWCHAR** wcPP) TTCmd::getNextColumnNullable(SQLWCHAR** wcPP, int* byteLenP) TTCmd::setParam(int pno, SQLBIGINT value) TTCmd::setParam(int pno, SQLTINYINT value) TTCmd::setParam(int pno, SQLWCHAR* valueP, int byteLen); TTCmd::getParam(int pno, SQLBIGINT* iP) TTCmd::getParam(int pno, SQLTINYINT* iP) TTCmd::getParam(int pno, SQLWCHAR** wcPP) TTCmd::getParam(int pno, SQLWCHAR** wcPP, int* byteLenP) TTCmd::BindParameter(int pno, u_short batSz, SQLBIGINT* user_biP) TTCmd::BindParameter(int pno, u_short batSz, SQLTINYINT* user_tiP) TTCmd::BindParameter(int pno, u_short batSz, SQLWCHAR** user_wcPP, SQLLEN* userByteLenP, size_t maxByteLen)
After you have configured your C++ environment, you can confirm that everything is set up correctly by compiling and running the TimesTen Quick Start demo applications. Refer to the Quick Start welcome page at install_dir/quickstart.html, especially the links under Sample Programs, for information about the following:
Demo schema and setup: The build_sampledb script creates a sample database and demo schema. You must run this before you start using the demos.
Demo environment and setup: The ttquickstartenv script, a superset of the ttenv script generally used for TimesTen setup, sets up the demo environment. You must run this each time you enter a session where you want to compile and run any of the demos.
Demos and setup: TimesTen provides demos for TTClasses and XLA in subdirectories under the install_dir/quickstart/sample_code directory. For instructions on compiling and running the demos, see the README files in the subdirectories.
What the demos do: A synopsis of each demo is provided.