skip to main content
Connection Property Descriptions : ConfigOptions : DefaultVarcharSize (Configuration Option)
  

Try DataDirect Drivers Now

DefaultVarcharSize (Configuration Option)

Purpose

Determines the default length of fields that are mapped as VARCHAR.

Valid Values

length | multiplier
where:
length
is the default length in characters given to columns that are discovered and mapped as VARCHAR.
multiplier
is a positive number immediately followed by the character x. For example, 3x. The positive integer is multiplied by the size of the largest object detected in a column to determine the default VARCHAR length for that column.

Behavior

If set to length, the value specified is the default length in characters for all fields that are discovered and mapped as VARCHAR. Values that exceed the specified default length are truncated when selected via the driver.
If set to multiplier, the default length for a VARCHAR column is defined by multiplying the multiplier value by the size, in characters, of the largest value detected in that column. Values that exceed the default length defined for the column are truncated when selected via the driver.
Note: When specifying a multiplier, you can define the maximum and minimum limits of the default length generated with the MaxVarcharSize and MinVarcharSize configuration options.

Example

For character values:
When DefaultVarcharSize is set to 200. When the driver discovers a column with a String size less than or equal to 200 characters, String is mapped as VARCHAR and the precision is 200 characters. When a column with a String size greater than 200 characters is discovered, the driver truncates the value to 200 characters.
For multiplier values:
When DefaultVarcharSize is set to 1.5x and the largest detected field in a column is 100 characters, the default length of fields mapped to VARCHAR is determined by multiplying 1.5 by 100, which results in a default length of 150 characters. When a value in that column exceeds 150 characters, the driver truncates the value to 150 characters.

Notes

*It is recommend that you specify a multiplier value for this option. Specifying a multiplier can improve memory efficiency within the driver and the application by having the length for every VARCHAR column proportionate to the size of the data for a given column.
*When a column with a String size greater than 4000 is discovered, the column is mapped as LONGVARCHAR and precision is 16 MB.
*The default length of fields for columns mapped as VARCHAR can be overridden using the Schema Tool. See About Column Information and Statistics for details.
*DefaultVarcharSize is not applied to columns that contain only ObjectIDs. Columns that contain only ObjectIDs are mapped as VARCHAR.

Default

1.5x

See also

*ConfigOptions
*MaxVarcharSize (Configuration Option)
*MinVarcharSize (Configuration Option)
*About Column Information and Statistics