Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK 10.1.3
Developing Drivers for Data Stores Without SQL

SimbaEngine X SDK Documentation > Core Features > Adding Custom Connection and Statement Properties

Adding Custom Connection and Statement Properties

Custom properties can be added to Connection and Statement objects. These properties allow you to customize how your connection and statement objects behave.

Important:

Before you can implement custom properties for your connection and statement attributes, you should request and reserve a value for each attribute from the Open Group. This ensures that no two drivers will assign the same integer value to different custom attributes. If you do not reserve a unique attribute or use one that is already in use, your driver may experience compatibility issues with any application that uses the conflicting custom attributes for other drivers.

For more information on requesting a value from the Open Group, refer to the Driver-Specific Data Types, Descriptor Types, Information Types, Diagnostic Types, and Attributes section of the MSDN ODBC Programmer’s Reference.

Custom Properties in the C++ SDK

You must define keys for each of the custom Connection or Statement properties or attributes for which you would like to add support. For each custom key, create a Simba::Support::AttributeData* to store data for the property or attribute. Use a map to map keys to their corresponding AttributeData*. For more information on creating a custom key refer to the DSIConnProperties.h or DSIStmtProperties.h header files in the folder [INSTALL_DIRECTORY]\DataAccessComponents\Include\DSI .

To add custom connection and statement properties, implement the following methods in your CustomerDSIIConnection and/or CustomerDSIIStatement class:

  • IsCustomProperty()

    In this function, check if the provided key corresponds with one of the standard ODBC properties. Return false if it does not; true otherwise.

    To see the list of keys for ODBC properties, see the Simba::DSI::DSIStmtPropertyKey enum or the Simba::DSI::DSIConnPropertyKey DSIConnPropertyKey enum in the C++ API reference. Go to SimbaEngine C++ API Reference, select the Namespaces tab, select Simba::DSI, then search for DSIConnPropertyKey.

  • SetCustomProperty()

    In this function, set an AttributeData* for the custom property key. In your implementation, check to ensure the provided key corresponds to a custom property or attribute. If it does not, an appropriate error or exception should be thrown and logged.

  • GetCustomProperty()

    This function retrieves the AttributeData* associated with a custom key. In your implementation, check to ensure the provided key corresponds to a custom property or attribute.

  • GetCustomPropertyType()

    This function retrieves the data type associated with the custom property or attribute. Data types are defined in the Simba::Support::AttributeType enum, located in the header folder [INSTALL_DIRECTORY]\DataAccessComponents\Include\Support\AttributeData.h.

Custom Properties in the Java SDK

Custom properties can be added to the drivers using the Java DSI with either the JNI DSI API, or the SimbaJDBC component. When using the JNI DSI API, custom properties are accessed in the same way that custom properties are accessed for ODBC drivers. When using the SimbaJDBC component, the custom properties are exposed through the following custom extensions to the Connection and Statement objects:

  • getAttribute(int)

    Retrieve a custom property identified by the integer key.

  • setAttribute(int, Object)
  • Set a custom property identified by the integer key.

Note:

Because these are custom extensions, applications will have to be coded to explicitly use these functions.

Custom Properties in the DotNet SDK

Custom properties can be added to drivers using the DotNet DSI, but can only be directly accessed when using the CLI DSI to build an ODBC driver.