Task 4: Configure Connections for TimesTen

Because TimesTen support of open source languages goes through OCI, you can connect to TimesTen from Python or Node.js using either the tnsnames or the Easy Connect naming method. See Connecting to a TimesTen Database 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 connecting to database sampledb. Then you would reference the TNS name, sampledbconn, for the connection 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 as myhost/sampledb:timesten_direct, directly in your code for the connection string.

Note:

Use timesten_direct for a direct connection to TimesTen or timesten_client for a client/server connection.

See Task 3: Configure Connections to TimesTen in Python and Task 3: Configure Connections to TimesTen in Node.js for examples using TNS names and Easy 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 Oracle TimesTen In-Memory Database SQL Reference.

The following example creates a TimesTen internal user appuser and grants CREATE SESSION and CREATE TABLE privileges so appuser can create a user session in connecting to the database and then create a database table.

CREATE USER appuser IDENTIFIED BY password;

GRANT CREATE SESSION TO appuser;
GRANT CREATE TABLE TO appuser;