Oracle TimesTen In-Memory Database

3y ago
49 Views
5 Downloads
254.42 KB
14 Pages
Last View : 11d ago
Last Download : 3m ago
Upload by : Jewel Payne
Transcription

Oracle TimesTen In-Memory DatabaseOpen Source Languages Support GuideRelease 18.1F24027-03July 2020This document discusses TimesTen In-Memory Database Release 18.1 support for opensource languages. This support applies to both TimesTen Classic and TimesTenScaleout. In the current release, the languages supported are Python and Node.js.These topics are covered in this document: Getting Started TimesTen setup Support for Python Support for Node.jsSample programs for the open source languages are available on GitHub. For anoverview of what is available, refer to README.md es/tree/master/languagesThere are additional README.md files with more information for each language,referenced later in this document.Getting StartedThis section discusses basic concepts and initial considerations in using open sourcelanguages supported by TimesTen (Python and Node.js).The following topics are covered here: ODPI-C and language-specific packages Platform support for open source languages Requirements for open source languages Restrictions for open source languagesODPI-C and language-specific packagesTimesTen support of open source languages is through the Oracle DatabaseProgramming Interface for C (ODPI-C). ODPI-C is an open source library from OracleCorporation designed to simplify access to Oracle databases from a variety ofprogramming languages. You can refer to https://oracle.github.io/odpi/ forinformation.For each language, there is an open source package, or driver, available throughGitHub and maintained by Oracle. Terminology for these packages varies fromlanguage to language: for example, extension module for Python or add-on for Node.js.1

See the section for each supported language below for information about thecorresponding package. ODPI-C is included when you download the driver for eachlanguage.ODPI-C is a layer on top of the Oracle Call Interface (referred to in this document asOCI, but not to be confused with Oracle Cloud Infrastructure). Figure 1 shows thearchitecture.Figure 1 TimesTen architecture for open source languagesPlatform support for open source languagesPlatform support for open source languages is of course limited to the platforms, or asubset of the platforms, supported by TimesTen, and may vary between languages.TimesTen supports client/server access from Linux, macOS, or Windows, or directaccess on Linux, for both Python and Node.js.For the latest information about platform support for each language, refer to theapplicable README.md file uages/nodejsFor more information about TimesTen platform support, including specific versionssupported, refer to "Platforms and configurations" in Oracle TimesTen In-MemoryDatabase Release Notes.Requirements for open source languagesUsing open source languages through ODPI-C for access to TimesTen databasesrequires use of the special OCI client library that is included with the Oracle InstantClient shipped with TimesTen software. Because you must use the Instant Client that issupplied with TimesTen, your library path must be set so that the TimesTen InstantClient directory (installation dir/ttoracle home/instantclient 12 1) precedesthe path to any Oracle Database libraries. The path is set appropriately when you usethe TimesTen ttenv script (ttenv.sh or ttenv.csh), described in "Install TimesTen" onpage 3.2

Restrictions for open source languagesBecause ODPI-C is a layer on top of OCI, TimesTen restrictions for OCI also apply toODPI-C. These restrictions are documented in "TimesTen restrictions and differences"in Oracle TimesTen In-Memory Database C Developer's Guide.In addition, these features are not supported: Application continuity Continuous query notification Call timeouts Session tagging Database management, including startup and shutdownTimesTen setupThis section discusses the following actions to set up TimesTen. Install TimesTen Set the TimesTen environment Define and manage the TimesTen database Configure connections for TimesTenInstall TimesTenIf you do not already have TimesTen, you can download it mportant: Full support for open source languages requires aTimesTen release of 18.1.4.1.0 or higher.There is a single ZIP file distribution for both TimesTen Classic and TimesTen Scaleout,but setup instructions differ from there: For prerequisites, environment setup, and installation for TimesTen Classic, referto "Overview of the Installation Process in TimesTen Classic" and the applicableinstallation chapter in Oracle TimesTen In-Memory Database Installation, Migration,and Upgrade Guide.The installation chapters also describe how to create a TimesTen instance. For prerequisites, environment setup, and installation for TimesTen Scaleout, referto "Prerequisites and Installation of TimesTen Scaleout" in Oracle TimesTenIn-Memory Database Scaleout User's Guide."Setting Up a Grid" in that document includes information about creating theinitial management instance.3

Set the TimesTen environmentAfter you have installed TimesTen and created a TimesTen instance, use theappropriate ttenv script (ttenv.sh or ttenv.csh) under timesten home/bin to finishsetting up the environment.Define and manage the TimesTen databaseFor defining and managing a database for TimesTen Classic, refer to "ManagingTimesTen Databases" in Oracle TimesTen In-Memory Database Operations Guide.For defining and managing a TimesTen grid and database for TimesTen Scaleout, referto "Setting Up the Membership Service", "Setting Up a Grid", and "Managing aDatabase" in Oracle TimesTen In-Memory Database Scaleout User's Guide.Configure connections for TimesTenBecause TimesTen support of open source languages goes through OCI, you canconnect to TimesTen from Python or Node.js using either the tnsnames or the easyconnect naming method. For details on these methods, see "Connecting to a TimesTendatabase from OCI" in Oracle TimesTen In-Memory Database C Developer's Guide.You may have a tnsnames.ora entry such as the following, for example, for connectingto database sampledb. Then you would reference the TNS name, sampledbconn, for theconnection string in your code.sampledbconn (DESCRIPTION (CONNECT DATA (SERVICE NAME sampledb)(SERVER timesten direct)))Or, to avoid using tnsnames.ora, you can use an easy connect string, such asmyhost/sampledb:timesten direct, directly in your code for the connection string.Use timesten direct for a direct connection to TimesTen or timesten client for aclient/server connection.See "Configure connections to TimesTen in Python" on page 6 and "Configureconnections to TimesTen in Node.js" on page 10 for examples using TNS names andeasy connect strings in your code.You will need a TimesTen database user in order to connect to a TimesTen database.For information about creating users in TimesTen, see "CREATE USER" in OracleTimesTen In-Memory Database SQL Reference.The following example creates a TimesTen internal user appuser with passwordappuser and grants CREATE SESSION and CREATE TABLE privileges so appuser cancreate a user session in connecting to the database and then create a database table.CREATE USER appuser IDENTIFIED BY "appuser";GRANT CREATE SESSION TO appuser;GRANT CREATE TABLE TO appuser;Support for PythonPython is an interpreted, high-level, general purpose language that includes supportfor object-oriented programming and a robust standard library. Simple syntax rulesmake Python code easy to read and support.4

Many platforms come with Python installed. Enter "python" at the command promptto confirm. If it is installed, its response will include the version number.You can find information about Python and download it fromhttps://www.python.orgFor information about Python versions supported by TimesTen, refer to the README.mdfile s/tree/master/languages/pythonThe Python extension module for access to Oracle or TimesTen databases from Pythonapplications is cx Oracle. This module conforms to the Python database API 2.0specification. There is general information about the module athttps://github.com/oracle/python-cx Oracle.For information about versions of the Python extension module supported byTimesTen, refer to the README.md file.The rest of this section covers these topics: Setup for Python Additional information for PythonSetup for PythonThis section covers these setup actions to use Python with TimesTen. Install the Python extension module Configure connections to TimesTen in PythonInstall the Python extension moduleYou must have internet access to install the Python extension module. You may haveto set the http proxy and https proxy environment variables to indicate your proxyserver(s) in order to access the internet outside of a firewall.There are several approaches for downloading the Python extension module. Choosethe approach that is most suitable for your setup and environment. Download source files from GitHub, using git clone. This requires git to beinstalled on your system. Refer to the instructions nt: Because the setup process requires access to the system libdirectory, administrative privilege is required.In addition to Python itself, your system must have the Pythonheader files, which requires that the correspondingpython[3]-devel development package is installed.Download prebuilt packages using the Python Pip package manager. Refer to theinstructions at ation as well as toplatform-specific sections of that document, as appropriate.5

This approach provides prebuilt binaries but downloads and compiles source codeas necessary.Important: In the event that source code must be compiled, you musthave package python[3]-devel installed. Download prebuilt binaries through a platform-specific package manager such asRPM.You can use the RPM package manager through a utility such as yum.The cx Oracle RPM packages are available from the Oracle Linux yum server(http://yum.oracle.com/). This is discussed n-oracle-linuxImportant: Using this approach requires Oracle Instant Client forsuccessful installation. If you do not yet have Instant Client on yoursystem, it will be provided. But for runtime operations, the InstantClient version that comes with TimesTen is required, as discussed in"Requirements for open source languages" on page 2.Information for all scenarios is available athttps://cx-oracle.readthedocs.io/en/latest/user guide/installation.htmlIn all three cases, ODPI-C is included. For the git cloneapproach, any dependencies, including ODPI-C, are automaticallycloned and built.Note:Configure connections to TimesTen in PythonSee "Configure connections for TimesTen" on page 4 for information about using theOracle tnsnames.ora or easy connect mechanisms to set up connections to yourdatabase.This example uses a TNS name for a Python connection string:connection cx Oracle.connect("appuser", "appuser", "sampledbconn")This example uses an easy connect string that specifies a direct connection toTimesTen:connection cx Oracle.connect("appuser", "appuser", "myhost/sampledb:timestendirect")Additional information for PythonThis section covers these topics: Type mappings for Python applications Failure modes for Python Python samples6

Type mappings for Python applicationsTable 1 documents mappings between cx Oracle types (as available through thelanguage extension module) and TimesTen SQL types.Additional TimesTen SQL types can be mapped to these cxOracle types as a result of TimesTen implicit data type conversions.See "Data type conversion" in Oracle TimesTen In-Memory Database SQLReference.Note:For the latest information about data type support in the current release, refer to theREADME.md file s/tree/master/languages/pythonTable 1Type mappings for cx Oraclecx Oracle typeTimesTen typecx Oracle.BINARYBINARY, VARBINARYcx Oracle.BLOBBLOBcx Oracle.CLOBCLOBcx oracle.CURSORREF CURSORcx Oracle.DATETIMEDATEcx Oracle.FIXED CHARCHARcx Oracle.FIXED NCHARNCHAR (In TimesTen, this type is UTF-16 only.)cx Oracle.NATIVE FLOATBINARY DOUBLE, BINARY FLOATcx Oracle.NCHARNVARCHAR2 (In TimesTen, this type is UTF-16 only.)cx Oracle.NCLOBNCLOBcx Oracle.NUMBERNUMBER, TT BIGINT, TT INTEGER, TT SMALLINT, TTTINYINTcx Oracle.ROWIDROWIDcx Oracle.STRINGVARCHAR2cx Oracle.TIMESTAMPTIMESTAMP, TT TIMESTAMPFailure modes for PythonBe aware of the following: Error messages may differ slightly from those produced by Oracle under the sameconditions.For the Python method Cursor.executemany(), TimesTen ignores the batcherrorsoption and therefore supports only the default batcherrors false setting. Anerror is always returned if any row in the batch encounters an error. (By contrast,Oracle Database supports batcherrors true, in which case success is alwaysreturned if any row in the batch is successful.) Also, against a TimesTen database,if multiple errors are encountered in a batch, TimesTen makes no attempt to orderthe errors as they would be ordered if encountered against an Oracle database.7

Python samplesThis section provides a simple Python example and a URL to TimesTen Python sampleapplications.Python example: Connect to TimesTen and execute SQL This simple sample programconnects to a TimesTen database, creates a table named employees, inserts three rowsinto the table, selects and displays the rows, drops the table, and disconnects from thedatabase.#### simple.py##from future import print functionimport cx Oracleimport AccessControldef run():try:credentials n cx Oracle.connect(credentials.user, credentials.password,credentials.connstr)cursor connection.cursor()cursor.execute("""CREATE TABLE employees(first name VARCHAR2(20), last name VARCHAR2(20))""")print("Table has been created")values [["ROBERT", "ROBERTSON"], ["ANDY", "ANDREWS"], T INTO employees VALUES (:1, :2)", values)print("Inserted ", len(values), "employees into the table")cursor.execute("""SELECT first name, last name FROM employees""")for fname, lname in cursor:print("Selected employee:", fname, lname)cursor.execute("DROP TABLE employees")print("Table has been nnection has been released")except Exception as e:# Something went wrongprint("An error occurred", str(e))run()Here are the results:% python3 simple.py -u username -p passwordTable has been createdInserted 3 employees into the tableSelected employee: ROBERT ROBERTSONSelected employee: ANDY ANDREWSSelected employee: MICHAEL MICHAELSONTable has been droppedConnection has been releasedDownload and run TimesTen Python sample programs TimesTen sample programs forPython through cx Oracle are available at8

tree/master/languages/pythonRefer to README.md at that location for information.Support for Node.jsNode.js is an open source Javascript runtime environment you can use to buildscalable network applications and tools, such as web servers. It includes "modules" toreduce the complexity of writing server applications by handling basic functions suchas file system I/O, networking, data streams, and cryptography.You can find information about Node.js and download it from https://nodejs.org.For information about Node.js versions supported by TimesTen, refer to the README.mdfile s/tree/master/languages/nodejsThe Node.js installation includes the package manager npm. Use this to install theNode.js add-on, as described below in the section about that add-on.The Node.js add-on for access to Oracle or TimesTen databases from Node.jsapplications is node-oracledb. There is general information about the add-on athttps://oracle.github.io/node-oracledb/.For information about versions of the Node.js add-on supported by TimesTen, refer tothe README.md file.The rest of this section covers these topics: Setup for Node.js Additional information for Node.jsSetup for Node.jsThis section covers these setup actions to use Node.js with TimesTen. Install the Node.js add-on Configure connections to TimesTen in Node.jsInstall the Node.js add-onYou must have internet access to install the Node.js ad-on. You may have to set thehttp proxy and https proxy environment variables to indicate your proxy server(s)in order to access the internet outside of a firewall.There are several approaches for downloading the Node.js add-on. Choose theapproach that is most suitable for your setup and environment. Download source files from GitHub, using git clone (requiring git to beinstalled on your system), then install the driver using the NPM package manager.You can install node-oracledb by downloading source files from GitHub. Onceyou have downloaded and extracted Node.js, you can optionally use the NPMpackage manager, located in the Node.js bin directory, to install a prebuiltnode-oracledb binary. (Add the Node.js bin directory to your path.)9

Refer to the installation instructions tml#-3-node-oracledb-installation-instructions under "Source code from GitHub". Download prebuilt packages using the NPM package manager.Refer to the installation instructions.This approach provides prebuilt binaries only. If prebuilt binaries are not available,you must compile the source code. In order to do this, you must have an OracleInstant Client installed. The one provided with TimesTen will suffice for this. Download prebuilt binaries through a platform-specific package manager such asRPM.The node-oracledb RPM packages are available from the Oracle Linux yum server(http://yum.oracle.com/).Refer to the installation instructions.Important: Using this approach requires Oracle Instant Client forsuccessful installation. If you do not yet have Instant Client on yoursystem, it will be provided. But for runtime operations, the InstantClient version that comes with TimesTen is required, as discussed in"Requirements for open source languages" on page 2.Information for all scenarios is available tml.In all three cases, ODPI-C is included. For the git cloneapproach, any dependencies, including ODPI-C, are automaticallycloned and built.Note:Configure connections to TimesTen in Node.jsSee "Configure connections for TimesTen" on page 4 for information about using theOracle tnsnames.ora or easy connect mechanisms to set up connections to yourdatabase.This example uses a TNS name for a Node.js connection string:// Get connectionfunction connect(cb) {oracledb.getConnection({user: "appuser",password: "appuser",connectString : "sampledbconn"} ,cb);}This example uses an easy connect string that specifies a direct connection toTimesTen:// Get connectionfunction connect(cb) {oracledb.getConnection({user: "appuser",10

password: "appuser",connectString : "myhost/sampledb:timesten direct"} ,cb);}Additional information for Node.jsThis section covers these topics: Type mappings for Node.js applications Failure modes for Node.js Node.js samplesType mappings for Node.js applicationsTable 2 documents mappings between node-oracledb types as available through thelanguage add-on and TimesTen SQL types.Additional TimesTen SQL types can be mapped to theseOracle Database types and node-oracledb alias types as a result ofTimesTen implicit data type conversions. See "Data type conversion"in Oracle T

This section discusses basic concepts and initial considerations in using open source . TimesTen support of open source languages is through the Oracle Database Programming Interface for C (ODPI-C). ODPI-C is an open source library from Oracle . the path to any Oracle Database libraries. The path is set appropriately when you use

Related Documents:

This section summarizes the new features of Oracle TimesTen In-Memory Database release 11.2.1 that are described in this guide. It provides links to more information. New features in Release 11.2.1.8.0 ODP.NET support for Oracle TimesTen In-Memory Database (TimesTen) provides ADO.NET data access from .NET client applications to TimesTen .

Oracle TimesTen In-Memory Database is a high-performance, in-memory data manager that supports the ODBC (Open DataBase Connectivity) and JDBC (Java DataBase Connectivity) interfaces. This guide is for application developers who use and administer TimesTen. It

About this Guide TimesTen documentation . . Copying, migrating, backing up and restoring a data store . . . . . . . .32 Working with the ODBC.INI file . . About this Guide Oracle TimesTen In-Memory Database is a high-performance, in-memory data manager that supports the ODBC and JDBC interfaces. This guide provides:

Oracle TimesTen is a an enterprise-class in-memory database with a rich feature set, with the intention of . in-process execution of database code. 7. . based, relying on shipping log records for committed transactions from a transmitter database to a receiver database, on which the changes in

Changes in This Release for Oracle Database In-Memory Guide Changes in Oracle Database 12c Release 2 (12.2.0.1) xii Part I Oracle Database In-Memory Concepts 1 Introduction to Oracle Database In-Memory 1.1 Challenges for Analytic Applications 1-1 1.2 The Single-Format Approach 1-2 1.3 The Oracle Database In-Memory Solution 1-2

viii Related Documentation The platform-specific documentation for Oracle Database 10g products includes the following manuals: Oracle Database - Oracle Database Release Notes for Linux Itanium - Oracle Database Installation Guide for Linux Itanium - Oracle Database Quick Installation Guide for Linux Itanium - Oracle Database Oracle Clusterware and Oracle Real Application Clusters

Changes in This Release for Oracle Database In-Memory Guide Changes in Oracle Database Release 18c, Version 18.1 xii Changes in Oracle Database 12c Release 2 (12.2.0.1) xiii Part I Oracle Database In-Memory Concepts 1 Introduction to Oracle Database In-Memory 1.1 Challenges for Analytic Applications 1-1 1.2 The Single-Format Approach 1-2 1.3 .

Archaeological illustration. [Cambridge manuals in archaeology] 930.1 ADKI Cambridge: Cambridge University Press, 1989 (2002 [printing]) Strier, Karen B. Primate behavioral ecology (Fifth edition.) 599.815 STRI London; New York: Routledge, 2017 Biology Biochemical Society (Great Britain), Estrela, Pedro Essays in biochemistry : volume 60, issue 1, Biosensor technologies for detection of .