Connectable Operations

Use ttGridAdmin commands in this section to create, delete, modify, export, or list connectable objects, used in connecting to a TimesTen Scaleout database. A connectable specifies a set of connection attribute settings and thereby defines an underlying DSN and tnsnames.ora file entry.

There are two types of connectables: direct connectables for direct mode access, and client/server connectables for client/server access.

You can have multiple connectables for a database to use different sets of connection attribute settings. For example, if you have one application designed to receive ASCII data from the database and another designed to receive Unicode data, then create two connectables, each with the appropriate ConnectionCharacterSet attribute setting.

Note:

A direct connectable, with the same name as the database, is created automatically when you define a database with the dbdefCreate command.

See Connecting to a Database and its subsections in Oracle TimesTen In-Memory Database Scaleout User's Guide for additional information about connectables.

Create a Connectable (connectableCreate)

The connectableCreate command creates a connectable object in the model, defining connection attribute settings.

ttGridAdmin connectableCreate -dbdef name
                               [-cs [-only hostname[.instancename]]]
                               filepath

Options

The connectableCreate command has the options:

Option Description

-dbdef name

The name of the database definition object that the connectable references (which is the name of the database to connect to).

-cs

Specifies that the connectable will be for client/server access to the database. If this is not specified, the connectable will be for direct mode access.

-only hostname[.instancename]

For client/server connections, optionally specifies that applications connecting through this connectable should connect to the indicated instance. By default, all data instances in the grid are available and connections are distributed among them.

You need to specify the instance name only if there is more than one instance on the host. (See Grid Objects and Object Naming.)

You can specify multiple -only options, in which case client/server applications can connect to any instance listed in the -only settings.

filepath

Path and name of the connectable file, which contains the connection attribute settings for the connectable. The file name must be of the form connname.connect, where connname defines the name of the connectable.

Also see the example below.

Examples

The example creates a client/server connectable using this connectable file, database1client.connect:

ConnectionCharacterSet=AL32UTF8
UID=ttclient

Create the connectable:

% ttGridAdmin connectableCreate -dbdef database1 -cs 
/sw/tten/grid/conndefs/database1client.connect
Connectable database1client created.

Notes

  • The connectable file must be in odbc.ini format, as shown in the example, with attribute=value on each line. A DSN name, in [name] format such as [database1client] here, is optional. If provided, it must match the connectable name determined by the connectable file name.

  • The default value is used for any connection attribute not set in the connectable.

  • When you apply the model after creating a connectable, new versions of all necessary configuration files are written to each data instance. This makes the connectable available for use. (Never edit configuration files manually. They are overwritten each time the model is applied.)

  • You cannot set data store (creation time) attributes or first connection attributes in the connectable file. Those must be set in the database definition file for the dbdefCreate or dbdefModify command.

  • Any settings for TTC_SERVER, TTC_SERVER_DSN, or TCP_PORT are ignored. Appropriate values for the grid topology are automatically used.

  • The connectable that is defined is usable through all APIs supported by TimesTen.

Delete a Connectable (connectableDelete)

The connectableDelete command deletes an existing connectable object from the model.

ttGridAdmin connectableDelete name

Options

The connectableDelete command has the option:

Option Description

name

The name of the connectable object to delete.

Examples

% ttGridAdmin connectableDelete database1client
Connectable database1client deleted from Model.

Notes

When you apply the model after deleting a connectable, new versions of all necessary configuration files are written to each data instance, with the connectable entry removed. (Never edit configuration files manually. They are overwritten each time the model is applied.)

Export a Connectable (connectableExport)

The connectableExport command exports a connectable object and its connection attribute settings, typically to a specified file.

ttGridAdmin connectableExport name 
                              [-file filepath]

Options

The connectableExport command has the options:

Option Description

name

Name of the connectable object to export.

-file filepath

Path and name of the connectable file to create, typically a .connect file for use with connectableCreate or connectableModify. If no file is specified, the export goes to stdout.

Important: If you specify an existing file, it will be overwritten.

Examples

This example exports the connectable created in the connectableCreate example to the file database1client.connect.

% ttGridAdmin connectableExport database1client -file /sw/tten/grid/conndefs/database1client.connect
Connectable database1client exported

Resulting contents of database1client.connect:

# Connectable GUID 3210288C-DF44-447D-ADB6-BDC8F7CFE17C Exported 2017-11-14 17:53:25
[database1client]
ConnectionCharacterSet=AL32UTF8
UID=ttclient

Note:

A typical use case is if you want to modify a connectable, but the original connectable file is no longer available.

List Connectables (connectableList)

The connectableList command lists the connectable objects that have been created in the specified version of the model.

ttGridAdmin connectableList [-latest|-current|-version n]
                            [-dbdef]

Options

The connectableList command has the options:

Option Description

-latest

Lists connectable objects in the latest model—the model being modified and not yet applied to the grid. This is the default.

-current

Lists connectable objects in the current model—the model most recently applied to the grid.

-version n

Lists connectable objects in the specified version number of the model.

-dbdef

Also lists the name of the database definition associated with each connectable object.

Examples

This example lists connectables and the associated database definitions from the model most recently applied to the grid.

% ttGridAdmin connectableList -current -dbdef
Connectable     DbDef
--------------- -----------
database1       database1
database1client database1

Only database1client was created by the user. A direct connectable is also automatically defined for each user-created database definition.

Modify a Connectable (connectableModify)

The connectableModify command modifies a connectable object.

ttGridAdmin connectableModify [-only hostname[.instancename]]
                              filepath

Options

The connectableModify command has the options:

Option Description

-only hostname[.instancename]

For connectables created for client/server connections (as determined by the -cs option of connectableCreate), optionally specifies that applications connecting through this connectable should connect to the indicated instance. By default, all data instances in the grid are available and connections are distributed among them.

You need to specify the instance name only if there is more than one instance on the host.

You can specify multiple -only options, in which case client/server applications can connect to any instance listed in the -only settings.

Note: Instances specified with connectableModify -only replace any instances specified with connectableCreate -only.

filepath

Path and name of the connectable file, which contains the new set of connection attribute settings. The file name must be of the form connname.connect, where connname is the name of the connectable.

Examples

The example modifies the client/server connectable created in the connectableCreate example, editing database1client.connect to add a PermWarnThreshold setting:

ConnectionCharacterSet=AL32UTF8
UID=ttclient
PermWarnThreshold=80

Modify the connectable:

% ttGridAdminttGridAdmin connectableModify /sw/tten/grid/conndefs/database1client.connect
Connectable database1client modified.

Notes

  • All connection attribute settings from the previous connectable file are replaced with the connection attribute settings in the specified file.

  • You cannot modify a connectable to change from client/server use to direct mode use, or from direct mode use to client/server use. Instead, delete the connectable and create a new one.

  • When you apply the model after modifying a connectable, new versions of all necessary configuration files are written to each data instance, with the connectable entry modified according to the new settings. (Never edit configuration files manually. They are overwritten each time the model is applied.)