c-treeACE V10.0 Update Guide

Previous Topic

Next Topic

Thread Impersonate - Connection Impersonating Another Connection

A unique feature we call “thread impersonate” has been implemented: We have introduced an API that can be used to cause a connection to impersonate another connection.

Note: This advanced feature should only be used by developers who have an in-depth knowledge of the way c-treeACE uses threading in your operating system.

The c-treeACE Server maintains a separate thread for each connected client. Each server thread has its own internal “Owner ID” to maintain context information associated with that user/connection. The server listens on two separate communications ports: one for SQL connections and one for ISAM connections. When a SQL or ISAM client connects, it has its own server thread/context.

We received customer requests to allow both the SQL and ISAM operations to be coordinated under a single database transaction. A new thread impersonation feature brings an advanced level of connection control never possible before.

A user can now connect a SQL client and an ISAM client, and then indicate to the server that the ISAM client wants to impersonate the SQL client. On the server, both connections will use the same “Owner ID” appearing as a single thread/context. As a result, sophisticated users can intermingle SQL and ISAM code within the same code/database transaction. This is a powerful method to gain performance advantages, particularly in instances where a speedy ISAM call is preferable to a slower SQL query.

Thread Impersonation is an advanced feature and requires careful implementation so contact your nearest FairCom office if you have interest in this technology.

Several API functions have been added to enable this feature.

c-treeACE Low-Level

  • ctImpersonateTask( )

c-treeDB C API

  • ctdbBeginImpersonation( )
  • ctdbEndImpersonation( )

c-treeDB C++ API

  • CTSession::BeginImpersonation( )
  • CTSession::EndImpersonation( )

c-treeACE SQL

  • fc_get_taskid( )
  • fc_set_impersonation( )

This section describes the functions used to implement thread impersonation: