In the following descriptions a term refers to any word or group of words that are language keywords, user-supplied values, literals, etc. A term’s exact meaning depends upon the context in which it is used.
• Italic font introduces a new term; typically, in the sentence that defines it for the first time.
• Fixed-width (mono-spaced) font is used for terms that must be given literally such as SQL commands, specific table and column names used in the examples, programming language keywords, etc. For example, SELECT * FROM emp;
• Italic fixed-width font is used for terms for which the user must substitute values in actual usage. For example, DELETE FROM table_name;
• Square brackets [ ] denote that one or none of the enclosed term(s) may be substituted. For example, [ a | b ], means choose one of “a” or “b” or neither of the two.
• Braces {} denote that exactly one of the enclosed alternatives must be specified. For example, { a | b }, means exactly one of “a” or “b” must be specified.
• Ellipses ... denote that the proceeding term may be repeated. For example, [ a | b ] ... means that you may have the sequence, “b a a b a”.
The EDB-ODBC Connector is distributed with and installed the EDB Postgres Advanced Server graphical or RPM installer.The name of the package that creates the repository file for Advanced Server is edb-repo. You can download the package at:After downloading the repository configuration file, assume superuser privileges, and use the following command to create the repository configuration file:The installer creates a repository configuration file named edb.repo; the file resides in /etc/yum.repos.d. The file contains entries for each of the EnterpriseDB repositories; to install the connector, you must enable the entry for the enterprisedb-tools repository:
1. Replace the user_name and password placeholders in the baseurl specification with your user name and the repository password.
2. After modifying the content of the repository configuration file, you can use the yum install command to install the connector; use the command:
Each command creates a repository configuration file in the /etc/zypp/repos.d directory. The files are named:After creating the repository configuration files, use the zypper refresh command to refresh the metadata on your SLES host to include the EnterpriseDB repositories:When prompted for a User Name and Password, provide your connection credentials for the EnterpriseDB repository. If you need credentials, contact EnterpriseDB at:
To install a DEB package on a Debian or Ubuntu host, you must have credentials that allow access to the EnterpriseDB repository. To request credentials for the repository, visit the EnterpriseDB Advanced Downloads page at:The following steps will walk you through on using the EnterpriseDB apt repository to install a DEB package. When using the commands, replace the username and password with the credentials provided by EnterpriseDB.
Download the installer, and then, right-click on the installer icon, and select Run As Administrator from the context menu.When the Language Selection popup opens, select an installation language and click OK to continue to the Setup window (shown in Figure 2.1).Click Next to continue.Use the Installation Directory dialog (see Figure 2.2) to specify the directory in which the connector will be installed, and click Next to continue.Click Next on the Ready to Install dialog (see Figure 2.3) to start the installation; popup dialogs confirm the progress of the installation wizard.When the wizard informs you that it has completed the setup, click the Finish button to exit the dialog (see Figure 2.4).You can also use StackBuilder Plus to add or update the connector on an existing Advanced Server installation; to open StackBuilder Plus, select StackBuilder Plus from the Windows Apps menu or through Linux Start menu (see Figure 2.5).When StackBuilder Plus opens, follow the onscreen instructions. Select the EnterpriseDB ODBC Connector option from the Database Drivers node of the tree control (see Figure 2.6).
The first line in the data source is the data source name. The name is a unique identifier, enclosed in square brackets. The data source name is followed by a series of 'keyword=value' pairs that identify individual connection properties that make up the data source.The ODBC administrator utility creates named data sources for ODBC connections. In most cases, an ODBC administrator utility is distributed with the operating system (if you’re using Windows or unixODBC, the tool is called the ODBC Data Source Administrator). If your operating system doesn’t include an ODBC administrator, third-party options are available online.Sections 2.3.1 and 2.3.2 walk you through adding a data source in Windows and Linux using the graphical tools available for each operating system. During the process of defining a data source, you’ll be asked to specify a set of connection properties. Section 2.3 contains information about optional data source connection properties; you can specify connection properties with graphical tools or edit the odbc.ini file with a text editor.
The following table describes the connection properties that you can specify through the dialogs in the graphical connection manager tools, or in the odbc.ini file that defines a named data source. The columns identify the connection property (as it appears in the ODBC Administrator dialogs), the corresponding keyword (as it appears in the odbc.ini file), the default value of the property, and a description of the connection property.
0 - Don't rollback1 - Rollback the transaction2 - Rollback the statement If enabled, the SQLStatistics() function will report unique indexes. If not enabled, the SQLStatistics() function reports that indexes allow duplicate values. If enabled, the driver will use server-side cursors. To enable UseDeclareFetch, specify a value of 1; to disable UseDeclareFetch, specify a value of 0. If enabled, the driver parses simple SELECT statements when you call the SQLNumResultCols(), SQLDescribeCol() or SQLColAttributes() functions. If enabled, the driver records its work in a log file. On Windows, the file name is C:\mylog_<process-id>; on Linux the file name is /tmp/mylog_<username><process-id>.log. Determines how the SQLDescribeCol() and SQLColAttributes() functions compute the size of a column. Specify 0 to force the driver to report the maximum size allowed for the type; specify 1 to force the driver to report an unknown length or 2 to force the driver to search the result set to find the longest value. Do not specify 2 if you have enabled UseDeclareFetch. If enabled, the driver treats TEXT columns as if they are of type SQL_LONGVARCHAR. If disabled, the driver treats TEXT columns as SQL_VARCHAR values. If enabled, the driver treats values of unknown type as SQL_LONGVARCHAR values. If unchecked, the driver will treat values of unknown type as SQL_VARCHAR values. By default, values of unknown type are treated as Y values. If enabled, the driver treats BOOL columns as SQL_CHAR values. If disabled, BOOL columns are treated as SQL_BIT values. If enabled, the driver treats VARCHAR and BPCHAR values longer than MaxVarCharSize as SQL_LONGVARCHAR values If UnknownAsLongVarChar is on, columns of unknown type are MaxLongVarcharSize bytes long; otherwise, they are reported to be MaxVarcharSize bytes in length. Use the SysTablePrefixes field to specify a semi-colon delimited list of prefixes that indicate that a table is a system table. By default, the list contains dd_;. If enabled, the SQLRowCount() function will return a single, cumulative row count for the entire array of parameter settings for an INSERT statement. If disabled, an individual row count will be returned for each parameter setting. By default, this option is disabled. The LF<->CR/LF conversion option instructs the driver to convert line-feed characters to carriage-return/line-feed pairs when fetching character values from the server and convert carriage-return/line-feed pairs back to line-feed characters when sending character values to the server. By default, this option is enabled. Permits positioned UPDATE and DELETE operations using the SQLSetPos() or SQLBulkOperations() functions. If enabled, the driver treats BYTEA values as if they are of type SQL_LONGVARBINARY. If disabled, BYTEA values are treated as SQL_VARBINARY values. The Row Versioning option specifies if the driver should include the xmin column when reporting the columns in a table. The xmin value is the ID of the transaction that created the row. You must use row versioning if you plan to create cursors where SQL_CONCURRENCY = SQL_CONCUR_ROWVER. Determines driver behavior if you try to retrieve information about a query without executing the query. If Yes, the driver declares a cursor for the query and fetches the meta-data from the cursor. If No, the driver executes the command as soon as you request any meta-data. TrueIsMinus1 tells the driver to return BOOL values of TRUE as -1. If this option is not enabled, the driver will return BOOL values of TRUE as 1. The driver always returns BOOL values of FALSE as 0. If enabled, the driver uses the PREPARE and EXECUTE commands to implement the Prepare/Execute model. 0x1 - Forces the output of short-length formatted connection strings. Specify this option if you are using the MFC CDatabase class.0x4 - Return ANSI character types for the inquiries from applications. Specify this option for applications that have difficulty handling Unicode data.0x8 - If set, NULL dates are reported as empty strings and empty strings are interpreted as NULL dates on input.0x10 - Determines if SQLGetInfo returns information about all tables, or only accessible tables. If set, only information is returned for accessible tables.0x20 - If set, each SQL command is processed in a separate network round-trip, otherwise, SQL commands are grouped into as few round-trips as possible to reduce network latency. If libpq (and its dependencies) are installed in the same directory as the EDB-ODBC driver, enabling SSL Mode allows you to use SSL and other utilities.
The Windows ODBC Data Source Administrator is a graphical interface that creates named data sources. You can open the ODBC Data Source Administrator (shown in Figure 2.2) by navigating to the Control Panel, opening the Administrative Tools menu, and double-clicking the appropriate ODBC Data Sources icon (32- or 64- bit).Click the Add button to open the Create New Data Source dialog (shown in Figure 2.3). Choose EnterpriseDB (ANSI) or EnterpriseDB (UNICODE) from the list of drivers and click Finish.
• Enter the Database name in the Database field.
•
• Enter the name of a user in the User Name field.
• Enter a descriptive name for the named data source in the Description field.
• If libpq is installed in the same directory as the EDB-ODBC driver, the drop-down listbox next to the SSL Mode label will be active, allowing you to use SSL and other Advanced Server utilities.
•
• Enter the password of the user in the Password field.Use the Datasource button (located in the Options box) to open the Advanced Options dialog (see Figure 2.5) and specify connection properties.The Global button opens a dialog on which you can specify logging options for the EDB-ODBC driver (not the data source, but the driver itself).Figure 2.5 - Page 1 of the Advanced Options dialog.
• Check the box next to Disable Genetic Optimizer to disable the genetic query optimizer. By default, the query optimizer is on.
• Check the box next to KSQO (Keyset Query Optimization) to enable server-side support for keyset queries. By default, Keyset Query Optimization is on.
• Check the box next to Recognize Unique Indexes to force the SQLStatistics() function to report unique indexes; if the option is not checked, the SQLStatistics() function will report that all indexes allow duplicate values. By default, Recognize Unique Indexes is on.
• Check the box next to Use Declare/Fetch to specify that the driver should use server-side cursors whenever your application executes a SELECT command. By default, Use Declare/Fetch is off.
• Check the box next to CommLog (C:\psqlodbc_xxxx.log) to record all client/server traffic in a log file. By default, logging is off.
• Check the box next to Parse Statements to specify that the driver (rather than the server) should attempt to parse simple SELECT statements when you call the SQLNumResultCols(), SQLDescribeCol(), or SQLColAttributes() function. By default, this option is off.
• Check the box next to Cancel as FreeStmt (Exp) to specify that the SQLCancel() function should call SQLFreeStmt(SQLClose) on your behalf. By default, this option is off.
• Check the box next to MyLog (C:\mylog_xxxx.log) to record a detailed record of driver activity in a log file. The log file is named c:\mylog_process-id.log. By default, logging is off.The radio buttons in the Unknown Sizes box specify how the SQLDescribeCol() and SQLColAttributes() functions compute the size of a column of unknown type (see Section 3.7, Supported Data Types for a list of known data types).
• Choose the button next to Maximum to specify that the driver report the maximum size allowed for a VARCHAR or LONGVARCHAR (dependent on the Unknowns as LongVarChar setting). If Unknowns as LongVarChar is enabled, the driver returns the maximum size of a LONGVARCHAR (specified in the Max LongVarChar field in the Miscellaneous box). If Unknowns as LongVarChar is not enabled, the driver returns the size specified in the Max VarChar field (in the Miscellaneous box).
• Choose the button next to Don’t know to specify that the driver report a length of "unknown".
• Choose the button next to Longest to specify that the driver search the result set and report the longest value found. (Note: you should not specify Longest if UseDeclareFetch is enabled.)The properties in the Data Type Options box determine how the driver treats columns of specific types:
• Check the box next to Text as LongVarChar to treat TEXT values as if they are of type SQL_LONGVARCHAR. If the box is not checked, the driver will treat TEXT values as SQL_VARCHAR values. By default, TEXT values are treated as SQL_LONGVARCHAR values.
• Check the box next to Unknowns as LongVarChar to specify that the driver treat values of unknown type as SQL_LONGVARCHAR values. If unchecked, the driver will treat values of unknown type as SQL_VARCHAR values. By default, values of unknown type are treated as SQL_VARCHAR values.
• Check the box next to Bools as Char to specify that the driver treat BOOL values as SQL_CHAR values. If unchecked, BOOL values are treated as SQL_BIT values. By default, BOOL values are treated as SQL_CHAR values.You can specify values for some of the properties associated with the named data source in the fields in the Miscellaneous box:
• Indicate the maximum length allowed for a VARCHAR value in the Max VarChar field. By default, this value is set to 255.
• Enter the maximum length allowed for a LONGVARCHAR value in the Max LongVarChar field. By default, this value is set to 8190.
• Specify the number of rows fetched by the driver (when UseDeclareFetch is enabled) in the Cache Size field. The default value is 100.
• Use the SysTablePrefixes field to specify a semi-colon delimited list of prefixes that indicate that a table is a system table. By default, the list contains dd_;.Click the Apply button to apply any changes to the data source properties, or the Cancel button to exit the dialog without applying any changes. Choose the OK button to apply any changes to the dialog and exit.Select the Page 2 button (in the upper-left hand corner of the Advanced Options dialog) to access a second set of advanced options (shown in figure 2.6).Figure 2.6 - Page 2 of the Advanced Options dialogs.
• Check the box next to Read Only to prevent the driver from executing the following commands: INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, GRANT, REVOKE or LOCK. Invoking the Read Only option also prevents any calls that use ODBC’s procedure call escape syntax (call=procedure-name?). By default, this option is off.
• Check the box next to Show System Tables to include system tables in the result set of the SQLTables() function. If the option is enabled, the driver will include any table whose name starts with pg_ or any of the prefixes listed in the SysTablePrefixes field of Page 1 of the Advanced Options dialog. By default, this option is off.
• Check the box next to Show sys/dbo Tables [Access] to access objects in the sys schema and dbo schema through the ODBC data source. By default, this option is enabled (checked).
• Check the box next to Cumulative Row Count for Insert to cause a single, cumulative row count to be returned for the entire array of parameter settings for an INSERT statement when a call to the SQLRowCount() method is performed. If this option is not enabled (the box is not checked), then an individual row count is available for each parameter setting in the array, and thus, a call to SQLRowCount() returns the count for the last inserted row.
• Check the box next to LF<->CR/LF conversion to instruct the driver to convert line-feed characters to carriage-return/line-feed pairs when fetching character values from the server and convert carriage-return/line-feed pairs back to line-feed characters when sending character values to the server. By default, this option is enabled.
• Check the box next to Updatable Cursors to specify that the driver should permit positioned UPDATE and DELETE operations with the SQLSetPos() or SQLBulkOperations() functions. By default, this option is enabled.
• Check the box next to bytea as LO to specify that the driver should treat BYTEA values as if they are SQL_LONGVARBINARY values. If the box is not checked, EDB-ODBC will treat BYTEA values as if they are SQL_VARBINARY values. By default, BYTEA values are treated as SQL_VARBINARY values.
• Check the box next to Row Versioning to include the xmin column when reporting the columns in a table. The xmin column is the ID of the transaction that created the row. You must use row versioning if you plan to create cursors where SQL_CONCURRENCY = SQL_CONCUR_ROWVER. By default, Row Versioning is off.
• Check the box next to Disallow Premature to specify that the driver should retrieve meta-data about a query (i.e., the number of columns in a result set, or the column types) without actually executing the query. If this option is not specified, the driver executes the query when you request meta-data about the query. By default, Disallow Premature is off.
• Check the box next to True is -1 to tell the driver to return BOOL values of True as a -1. If this option is not enabled, the driver will return BOOL values of True as 1. The driver always returns BOOL values of False as 0.
• Check the box next to Server side prepare to tell the driver to use the PREPARE and EXECUTE commands to implement the Prepare/Execute model. By default, this box is checked.
• Check the box next to use gssapi for GSS request to instruct the driver to send a GSSAPI connection request to the server.
• Enter the database system (either EnterpriseDB or PostgreSQL) in the dbms_name field. The value entered here is returned in the SQL_DBMS_NAME argument when the SQLGetInfo() function is called. The default is EnterpriseDB.Use the radio buttons in the Int8 As box to specify how the driver should return BIGINT values to the client. Select the radio button next to default to specify the default type of NUMERIC if the client is MS Jet, BIGINT if the client is any other ODBC client. You can optionally specify that the driver return BIGINT values as a bigint (SQL_BIGINT), numeric (SQL_NUMERIC), varchar (SQL_VARCHAR), double (SQL_DOUBLE), or int4 (SQL_INTEGER).
If set, NULL dates are reported as empty strings and empty strings are interpreted as NULL dates on input. Determines if SQLGetInfo returns information about all tables, or only accessible tables. If set, only information is returned for accessible tables. The Protocol box contains radio buttons that tell the driver to interact with the server using a specific front-end/back-end protocol version. By default, the Protocol selected is 7.4+; you can optionally select from versions 6.4+, 6.3 or 6.2.The Level of Rollback on errors box contains radio buttons that specify how the driver handles error handling:
The OID Options box contains options that control the way the driver exposes the OID column contained in some tables:
• Check the box next to Show Column to include the OID column in the result set of the SQLColumns() function. If this box is not checked, the OID column is hidden from SQLColumns().
• Check the box next to Fake Columns to specify that the SQLStatistics() function should report that a unique index exists on each OID column.Use the Connect Settings field to specify a list of parameter assignments that the driver will use when opening this connection. Any configuration parameter that you can modify with a SET statement can be included in the semi-colon delimited list. For example:When you’ve defined the connection properties for the named data source, click the Apply button to apply the options; you can optionally exit without saving any options by choosing Cancel. Select the OK button to save the options and exit.Choose the Global button (on the EnterpriseDB ODBC Driver dialog) to open the Global Settings dialog (shown in Figure 2.7). The options on this dialog control logging options for the EDB-ODBC driver. Use this dialog to enforce logging when the driver is used without a named data source, or for logging driver operations that occur before the connection string is parsed.
• Check the box next to the CommLog field to record all client/server traffic in a log file. The logfile is named C:\psqlodbc_process-id where process-id is the name of the process in use.
• Check the box next to the Mylog field to keep a logfile of the driver’s activity. The logfile is named c:\mylog_process-id where process-id is the name of the process in use.
• When you’ve entered the connection information for the named data source, click the Test button to verify that the driver manager can connect to the defined data source (see Figure 2.8).Click the OK button to exit Connection Test dialog. If the connection is successful, click the Save button to save the named data source. If there are problems establishing a connection, adjust the parameters and test again.
The Linux ODBC Administrator is a graphical tool that is distributed with unixODBC; you can use the ODBC Administrator to manage ODBC drivers and named resources. To add the ODBC Administrator to your system, open a terminal window, assume superuser privileges, and enter:To invoke the ODBC Administrator (shown in Figure 2.9), open a terminal window and enter ODBCConfig.When you install the Advanced Server Connectors component, the EDB-ODBC driver is added to the list of drivers in the ODBC Administrator. Click Advanced, and then select the Drivers tab to verify that the enterprisedb driver appears in the list (see Figure 2.10).If the EDB-ODBC driver does not appear in the list of drivers, you can add it using the ODBC Administrator. To add a driver definition, select the Drivers tab, and click Add. The Driver Properties (new) window opens, as shown in Figure 2.11.Figure 2.11 - The Driver Properties window.Complete the Driver Properties window to register the EDB-ODBC driver with the driver manager:
• Add a unique name for the driver to the Name field.
• Add a driver description to the Description field.
• Add the path to the location of the EDB-ODBC driver in the Driver field. By default, the complete path to the driver is:
• Add the path to the location of the EDB-ODBC driver setup file in the Setup field. By default, the complete path to the driver setup file is:When you’ve described the driver properties for the EDB-ODBC driver, click OK. The ODBC Data Source Administrator window now includes the EDB-ODBC driver in the list of available ODBC drivers (Figure 2.12).With the EDB-ODBC driver available to the driver manager, you can add a data source. Click the Data Source Names option in the left panel, and then choose the appropriate DSN tab for the type of data source name you would like to add:
• Choose the User tab to add a named data source that is available only to the current user (the data source will be stored in ~user/.odbc.ini).
• Choose the System tab add a named data source that is available to all users. All system data sources are stored in a single file (usually /etc/odbc.ini).
• Choose the File tab to add a named data source that is available to all users, but that is stored in a file of your choosing.Select the appropriate tab and click Add. The Create a New Data Source… window opens, as shown in Figure 2.13.Complete the Data Source Properties (new) window (shown in Figure 2.14), specifying the connection properties for the EDB-ODBC driver.
•
•
• The unixODBC driver includes a trace utility that records the sequence of calls made an ODBC application to a log file. Specify Yes in the Trace field to turn the trace utility on. Note that using the trace utility can slow down an application.
•
•
• Enter the host name or IP address of Advanced Server in the Servername field.
•
•
•
• Use the Protocol field to specify a front-end/back-end protocol version; the default value is 7.4. You can optionally select from protocol versions 7.4, 6.4, 6.3 or 6.2.
• Use the ReadOnly field to specify Yes to prevent the driver from executing the following commands: INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, GRANT, REVOKE or LOCK. Enabling the Read Only option also prevents any calls that use the ODBC procedure call escape syntax (call=procedure-name?). By default, ReadOnly is set to No.
• Use the RowVersioning field to specify Yes if the driver should include the xmin column when reporting the columns in a table. The xmin column is the ID of the transaction that created the row. You must use row versioning if you plan to create cursors where SQL_CONCURRENCY = SQL_CONCUR_ROWVER. By default, Row Versioning is set to No.
• Use the ShowSystemTables field to specify Yes if the driver should include system tables in the result set of the SQLTables() function. By default, this field is set to No.
• Use the ShowOidColumn field to specify Yes if the driver should include the OID column in the result set of the SQLColumns() function. If ShowOidColumn is set to No, the OID column is hidden from SQLColumns(). By default, this option is set to No.
• Use the FakeOidIndex field to specify Yes if the SQLStatistics() function should report that a unique index exists on each OID column. This is useful when your application needs a unique identifier and your table doesn’t include one. The default value is No.
• Use the ConnSettings field to specify a list of parameter assignments that the driver will use when opening this connection.
• SQLGetInfo() returns information about the EDB-ODBC driver and Advanced Server.
• SQLGetEnvAttr() returns information about ODBC environment attributes.
• SQLGetConnectAttr() returns information about attributes specific to an individual connection.
• SQLGetStmtAttr() returns information about the attributes specific to an individual statement.
• Use the SQLSetConnectAttr() function to set connection attributes.
• Use the SQLSetEnvAttr() function to set environment attributes.
• Use the SQLSetStmtAttr() function to set statement attributes.
4.1 SQLGetInfo()The ODBC SQLGetInfo() function returns information about the EDB-ODBC driver and Advanced Server. You must have an open connection to call SQLGetInfo(), unless you specify SQL_ODBC_VER as the info_type. The signature for SQLGetInfo() is:SQLHDBC conn_handle, // InputSQLUSMALLINT info_type, // InputSQLPOINTER info_pointer, // OutputSQLSMALLINT buffer_len, // InputSQLSMALLINT *string_length_pointer // OutputIf the info_type argument is SQL_DRIVER_HDESC or SQL_DRIVER_HSTMT, the info_pointer argument is both Input and Output.buffer_len is the length of the allocated memory buffer pointed to by info_pointer. If info_pointer is NULL, buffer_len is ignored. If the returned value is a fixed size, buffer_len is ignored. buffer_len is only used if the requested value is returned in the form of a character string.string_length_pointer is a pointer to an SQLSMALLINT value. SQLGetInfo() writes the size of the requested value in this integer.A typical usage is to call SQLGetInfo() with a NULL info_pointer to obtain the length of the requested value, allocate the required number of bytes, and then call SQLGetInfo() again (providing the address of the newly allocated buffer) to obtain the actual value. The first call retrieves the number of bytes required to hold the value; the second call retrieves the value.If the size of the returned value exceeds buffer_len, the information is truncated and NULL terminated. If the returned value is a fixed size, string_length is ignored (and the size of the requested value is not provided by SQLGetInfo()).SQLGetInfo() writes information in one of the following formats:
• a SQLUINTEGER bitmask
• a SQLUINTEGER flag
• a SQLUINTEGER binary value
• a SQLUSMALLINT value
• a NULL terminated character stringThe following table lists the information returned by EDB-ODBC about the Advanced Server connection:
SQL info_type Argument Returns N Returns N prev. SQL_MAX_DRIVER_CONNECTIONS Returns 0 Returns 0 Returns 0 Returns SQL_AF_ALL Returns 0ALTER DOMAIN clauses are not supported. Returns SQL_AM_NONE Returns SQL_BRC_EXPLICIT Now SQL_QUALIFIER_LOCATION Now SQL_QUALIFIER_NAME Returns Y Now SQL_QUALIFIER_NAME_SEPARATOR Now SQL_QUALIFIER_TERM Returns catalog Now SQL_QUALIFIER USAGE Returns SQL_CU_DML_STATEMENTSCatalog names can be used in SELECT, INSERT, UPDATE, DELETE, SELECT FOR UPDATE and positioned UPDATE and DELETE statements. Returns Y Returns SQL_CB_NON_NULL Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns SQL_CN_ANY Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns SQL_CV_CREATE_VIEW Returns SQL_CB_PRESERVE Returns SQL_CB_PRESERVE Returns the value given by the dbms_name parameter from the odbc.ini file on Linux or the dbms_name field of page 2 of the Advanced Options dialog box when defining a data source in Windows. The default is EnterpriseDB. Returns TXN_READ_COMMITTED Returns N Returns an SQLULEN value that contains the library handle (returned to the ODBC driver manager when the manager loaded the driver). Returns EDB-ODBC.DLL Returns 03.50 Returns 9.0.0.6 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 Returns Y Returns SQL_FILE_NOT_SUPPORTED Returns SQL_CA1_NEXT Describes extended attributes for the forward-only cursor designated by SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1. Lists supported extensions to SQLGetData. Returns SQL_GB_GROUP_BY_EQUALS_SELECT Returns SQL_IC_LOWER Returns " Returns SQL_IK_NONE Lists the views supported in the INFORMATION_SCHEMA. Returns 0 Prev. SQL_ODBC_SQL_OPT_IEF Returns N Returns "" Returns N Returns SQL_LCK_NO_CHANGE Returns 0 Returns 0 Returns 0 Returns 0 Returns 64 Returns 0 Returns 0 Returns 0 Returns 0 Returns 0 prev. SQL_MAX_ACTIVE_STATEMENTS Returns 0 Returns 32 prev. SQL_ACTIVE_CONNECTIONS Returns 0 Returns 64 Returns 0 Now SQL_MAX_SCHEMA_NAME_LEN Returns 64 Returns 0 Now SQL_MAX_CATALOG_NAME_LEN Returns 0 Returns 0 Indicates whether the SQL_MAX_ROW_SIZE includes the length of any LONGVARCHAR or LONGVARBINARY columns in the row. Returns Y Returns 64 Returns 0 Returns 64 Returns 0 Returns 0 Returns SQL_NNC_NON_NULL Returns SQL_NC_HIGHThe location of NULL values in a data set is determined by the ASC and DESC keywords; NULL values are sorted to the high end of the data set. Returns SQL_OAC_LEVEL1 Returns SQL_OIC_CORE Returns SQL_OSCC_NOT_COMPLIANT Returns SQL_OSC_CORE Now SQL_INTEGRITY Returns N Returns 03.52.0000 Returns SQL_OJ_LEFT Returns Y prev. SQL_SCHEMA_TERM Returns schema Returns N prev. SQL_SCHEMA_USAGE Returns SQL_OU_DML_STATEMENTS Returns SQL_PARC_BATCH Returns SQL_PAS_BATCH Returns procedure Returns Y prev. SQL_CATALOG_LOCATION prev. SQL_CATALOG_NAME Returns Y prev. SQL_CATALOG_NAME_SEPARATOR prev. SQL_CATALOG_TERM Returns catalog prev. SQL_CATALOG_USAGE Returns SQL_CU_DML_STATEMENTSCatalog names can be used in SELECT, INSERT, UPDATE, DELETE, SELECT FOR UPDATE and positioned UPDATE and DELETE statements. Returns SQL_CU_DML_STATEMENTS Returns SQL_IC_SENSITIVE Returns . Returns catalog Returns SQL_CL_START Returns Y Returns schema Returns \ Returns _ Returns SQL_SC_SQL92_ENTRY Indicates the row value constructor expressions in a SELECT statement that are supported by the server. Indicates whether changes made to a static cursor by SQLSetPos() or UPDATE or DELETE statements are detected by the application. Returns 0 Returns table Returns 0 Returns 0 Returns SQL_TC_ALL
You can use the ODBC SQLGetConnectAttr() and SQLSetConnectAttr() functions to retrieve or set the value of a connection attribute.4.2.1 SQLGetConnectAttr()The SQLGetConnectAttr() function returns the current value of a connection attribute. The signature is:SQLHDBC conn_handle, //InputSQLINTEGER attribute, //InputSQLPOINTER value_pointer, //OutputSQLINTEGER buffer_length, //InputSQLINTEGER *string_length_pointer //Outputattribute identifies the attribute whose value you wish to retrieve.A pointer to the location in memory that will receive the attribute value.If attribute is defined by ODBC and value_pointer points to a character string or binary buffer, buffer_length is the length of value_pointer. If value_pointer points to a fixed-size value (such as an integer), buffer_length is ignored.If EDB-ODBC defines the attribute, SQLGetConnectAttr() sets the buffer_length parameter. buffer_length can be:
The result of SQL_LEN_BINARY_ATTR(length) A pointer to a SQLINTEGER that receives the number of bytes available to return in value_pointer. If value_pointer is NULL, string_length_pointer is not returned.This function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA, SQL_ERROR or SQL_INVALID_HANDLE.
4.2.2 SQLSetConnectAttr()You can use the ODBC SQLSetConnectAttr() function to set the values of connection attributes. The signature of the function is:SQLHDBC conn_handle, // InputSQLINTEGER attribute, // InputSQLPOINTER value_pointer, // InputSQLINTEGER string_length, // Inputattribute identifies the attribute whose value you wish to setA pointer to the value that the attribute will assume.If attribute is defined by ODBC and value_pointer points to a binary buffer or character string, string_length is the length of value_pointer. If value_pointer points to a fixed-length value (such as an integer), string_length is ignored.If EDB-ODBC defines the attribute, the application sets the string_length parameter. Possible string_length values are:
The result of SQL_LEN_BINARY_ATTR(length) SQLSetConnectAttr() returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_STILL_EXECUTING or SQL_INVALID_HANDLE.You can call SQLSetConnectAttr() any time after the connection handle is allocated, until the time that the connection is closed with a call to SQLFreeHandle(). All attributes set by the call persist until the call to SQLFreeHandle().
You can use the ODBC SQLGetEnvAttr() and SQLSetEnvAttr() functions to retrieve or set the value of an environment attribute.4.3.1 SQLGetEnvAttr()Use the SQLGetEnvAttr() function to find the current value of environment attributes on your system. The signature of the function is:SQLHDBC env_handle, // InputSQLINTEGER attribute, // InputSQLPOINTER value_ptr, // OutputSQLINTEGER buffer_length, // InputSQLINTEGER *string_length_pointer // Outputattribute identifies the attribute whose value you wish to retrieve.A pointer to the location in memory that will receive the attribute value.If the attribute is a character string, buffer_length is the length of value_ptr. If the value of the attribute is not a character string, buffer_length is unused.A pointer to a SQLINTEGER that receives the number of bytes available to return in value_pointer. If value_pointer is NULL, string_length_pointer is not returned.This function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA, SQL_ERROR or SQL_INVALID_HANDLE.
4.3.2 SQLSetEnvAttr()You can use the SQLSetEnvAttr() function to set the values of environment attributes. The signature of the function is:SQLHENV env_handle, //InputSQLINTEGER attribute, //InputSQLPOINTER value_pointer, //InputSQLINTEGER string_length //Inputattribute identifies the attribute whose value you wish to set.A pointer to the value assigned to the attribute. The value will be a NULL terminated character string or a 32 bit integer value depending on the specified attribute.If value_pointer is a pointer to a binary buffer or character string, string_length is the length of value_pointer. If the value being assigned to the attribute is a character, string_length is the length of that character string. If value_pointer is NULL, string_length is not returned. If value_pointer is an integer, string_length is ignored.The application must call SQLSetEnvAttr() before allocating a connection handle; all values applied to environment attributes will persist until SQLFreeHandle() is called for the connection. ODBC version 3.x allows you to allocate multiple environment handles simultaneously.
Defaults to SQL_TRUE. Calls that set this attribute to SQL_FALSE return SQL_ERROR/SQLSTATEHYC00 (feature not implemented).
You can use the ODBC SQLGetStmtAttr() and SQLSetStmtAttr() functions to retrieve and set the value of a statement attribute.4.4.1 SQLGetStmtAttr()SQLHDBC stmt_handle, //InputSQLINTEGER attribute, //InputSQLPOINTER value_ptr, //OutputSQLINTEGER buffer_length, //InputSQLINTEGER *string_length_pointer //Outputattribute is the attribute valueA pointer to the location in memory that will receive the attribute value.If the attribute is defined by ODBC, buffer_length is the length of value_pointer (if value_pointer points to a character string or binary buffer). If value_pointer points to an integer, buffer_length is ignored.If EDB-ODBC defines the attribute, the application sets the buffer_length parameter. buffer_length can be:
The result of SQL_LEN_BINARY_ATTR(length) A pointer to an SQLINTEGER that receives the number of bytes required to hold the requested value. If value_pointer is NULL, string_length_pointer is not returned.
4.4.2 SQLSetStmtAttr()You can use the SQLSetStmtAttr() function to set the values of environment attributes. The signature is:SQLHENV stmt_handle, //InputSQLINTEGER attribute, //InputSQLPOINTER value_pointer, //InputSQLINTEGER string_length //Inputstmt_handle is the environment handle.attribute identifies the statement attribute whose value you wish to set.value_pointer is a pointer to the location in memory that holds the value that will be assigned to the attribute. value_pointer can be a pointer to:
•
• A SQLUINTEGER value
• A SQLULEN valueIf attribute is defined by ODBC and value_pointer points to a binary buffer or character string, string_length is the length of value_pointer. If value_pointer points to an integer, string_length is ignored.If EDB-ODBC defines the attribute, the application sets the string_length parameter. Possible string_length values are:
The result of SQL_LEN_BINARY_ATTR(length)
4.5 Error HandlingDiagnostic information for the ODBC functions mentioned in this guide can be retrieved via the ODBC SQLGetDiagRec() function.4.5.1 SQLGetDiagRec()The SQLGetDiagRec() function returns status and error information from a diagnostic record written by the ODBC functions that retrieve or set attribute values. The signature is:SQLSMALLINT handle_type, // InputSQLHANDLE handle, // InputSQLSMALLINT record_number, // InputSQLCHAR *SQLState_pointer, // OutputSQLINTEGER *native_error_pointer, // OutputSQLCHAR *error_text_pointer, // OutputSQLSMALLINT buffer_length, // Input
• SQL_HANDLE_ENV specifies an environment handle.
• SQL_HANDLE_STMT specifies a statement handle.
• SQL_HANDLE_DBC specifies a connection handle.
• SQL_HANDLE_DESC specifies a descriptor handle.The status record that the application is seeking information from (must be greater than or equal to 1).Pointer to a buffer that receives the native error message for the data source (contained in the SQL_DIAG_NATIVE field).Pointer to a memory buffer that receives the error text (contained in the SQL_DIAG_MESSAGE_TEXT field)Pointer to the buffer that receives the size (in characters) of the error_text_pointer field. If the number of characters in the error_text_pointer parameter exceeds the number available (in buffer_length), error_text_pointer will be truncated.SQLGetDiagRec() returns SQL_SUCCESS, SQL_ERROR, SQL_INVALID_HANDLE, SQL_SUCCESS_WITH_DATA or SQL_NO_DATA
The following table lists the ODBC API functions; the right column specifies Yes if the API is supported by the EDB-ODBC driver. Use the ODBC SQLGetFunctions() function (specifying a function ID of SQL_API_ODBC3_ALL_FUNCTIONS) to return a current version of this list.
4.8 Thread Safety