Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK 10.1.3
Developing Drivers for Data Stores Without SQL

SimbaEngine X SDK Documentation > Core Features > Overriding the Value of Default Properties

Overriding the Value of Default Properties

ODBC and JDBC drivers use connection, driver, environment, and statement properties to specify and define their behavior and capabilities. The SimbaEngine X SDK provides default values for these properties. If the capabilities of your custom driver are different from the specified defaults, or if you need to support the requirements of a specific application, you can override these default values.

The SimbaEngine X SDK implements these properties in the following classes in the Core library:

Property Type Class Name of Property Map

Connection properties

DSIConnection

m_connectionProperties

Driver properties

DSIDriver

m_driverProperties

Environment properties

DSIEnvironment

m_environmentProperties

Statement properties

DSIStatement

m_statementProperties

Note:

For information about SQL Engine properties, see Using SQL Engine Properties.

Properties are represented as key-value string pairs, which are stored in a property map as shown in the table above. Properties are initialized with their default value in the constructor of the corresponding class.

You can override these properties in your DSII subclass of the corresponding Core class, but you must only override the default value for any property during the construction of each class instance. After that, property changes should only come from the ODBC application calling the appropriate API function. The one exception to this rule is that connection properties may be updated at the time a connection is successfully established. This should be done before returning from the CustomerDSIIConnection::connect function.

Each of these four Core classes has a function called SetProperty, which is used to set the value for a property or attribute.

For a description of properties and default values in the C++ SDK, see the SimbaEngine C++ API Reference. Select Namespaces -> Simba::DSI then see the following enumerations:

  • DSIConnPropertyKey
  • DSIDriverPropertyKey
  • DSIEnvPropertyKey
  • DSIStmtPropertyKey

For a description of properties and default values in the Java SDK, see the following classes in the SimbaEngine Java API Reference:

  • ConnPropertyKey
  • DriverPropertyKey
  • EnvPropertyKey
  • StmtPropertyKey

Note:

The term "property" and "attribute" are used interchangeably in the SimbaEngine X SDK. For example, a method might be called GetProperty but work with AttributeData objects.

Example: Overriding the Value of Connection Properties

The example in this section shows how to override default property and attribute values for the DSIConnection class. You can use the same method to override default values in the DSIStatement, DSIDriver and DSIEnvironment classes.

Note:

This example is in C++ but it also applies to the Java SDK.

The example subclass of DSIConnection is called CustomerDSIIConnection. In the CustomerDSIIConnection constructor, use the DSIConnection::SetProperty() method to set the property or attribute value. The signature of the DSIConnection::SetProperty function is:

virtual void SetProperty(

DSIProperties::DSIConnPropertyKeys::DSIConnPropertyKey in_key,

Simba::Support::Utility::AttributeData* in_value)

Example: Set the server name

The default value for DSI_SERVER_NAME is “ ”. It should be set to the name of the DSI server. Pass in the key for the server name and the name of the server to the SetProperty function.

SetProperty(

DSIProperties::DSIConnPropertyKeys::DSI_SERVER_NAME,

Utility::AttributeData::MakeNewWStringAttributeData(<name_of_server>)

);

Example: Specify the Supported SQL_CHAR Conversions

The default value for DSI_SUPPORTED_SQL_CHAR_CONVERSIONS is DSI_CVT_CHAR. If the application supports more conversions, you need to change this value. Here, the value for the DSI_SUPPORTED_CHAR_CONVERSIONS property is made up of a concatenation of all the values provided.

SetProperty(

DSIProperties::DSIConnPropertyKeys::DSI_SUPPORTED_SQL_CHAR_CONVERSIONS,

Utility::AttributeData::MakeNewUInt32AttributeData(

DSIProperties::DSIConnPropertyValues::DSI_CVT_CHAR |

DSIProperties::DSIConnPropertyValues::DSI_CVT_NUMERIC |

DSIProperties::DSIConnPropertyValues::DSI_CVT_DECIMAL |

DSIProperties::DSIConnPropertyValues::DSI_CVT_INTEGER |

DSIProperties::DSIConnPropertyValues::DSI_CVT_SMALLINT |

DSIProperties::DSIConnPropertyValues::DSI_CVT_FLOAT |

DSIProperties::DSIConnPropertyValues::DSI_CVT_REAL |

DSIProperties::DSIConnPropertyValues::DSI_CVT_VARCHAR |

DSIProperties::DSIConnPropertyValues::DSI_CVT_LONGVARCHAR |

DSIProperties::DSIConnPropertyValues::DSI_CVT_BINARY |

DSIProperties::DSIConnPropertyValues::DSI_CVT_VARBINARY |

DSIProperties::DSIConnPropertyValues::DSI_CVT_BIT |

DSIProperties::DSIConnPropertyValues::DSI_CVT_TINYINT |

DSIProperties::DSIConnPropertyValues::DSI_CVT_BIGINT |

DSIProperties::DSIConnPropertyValues::DSI_CVT_TIMESTAMP |

DSIProperties::DSIConnPropertyValues::DSI_CVT_LONGVARBINARY |

DSIProperties::DSIConnPropertyValues::DSI_CVT_WCHAR |

DSIProperties::DSIConnPropertyValues::DSI_CVT_WLONGVARCHAR |

DSIProperties::DSIConnPropertyValues::DSI_CVT_WVARCHAR)

);

 

Related Links

Using SQL Engine Properties