Hitachi

Hitachi Advanced Database Application Development Guide


16.3.4 SQLBrowseConnect, SQLBrowseConnectW

Organization of this subsection

(1) Function

This ODBC function supports a method of referencing attributes and attribute values one at time that are required to establish a connection with the data source (HADB server). Each call to SQLBrowseConnect or SQLBrowseConnectW returns successive levels of attributes and attribute values. When all levels of attributes are specified, a connection to the data source is completed and a complete connection character string is returned by SQLBrowseConnect or SQLBrowseConnectW.

Note that you must have the CONNECT privilege to execute SQLBrowseConnect and SQLBrowseConnectW.

(2) Format

(3) Arguments

ConnectionHandle

Specifies a connection handle.

InConnectionString

Specifies a browse request connection character string.

The following table lists and describes the connection attributes that can be specified in the browse request connection character string.

Connection attribute

Description

DSN

Data source name

DRIVER

ODBC driver name: Hitachi Advanced Data Binder ODBC Driver

UID

Authorization identifier

PWD

Password

CLTPATH

Absolute path of a client definition file

StringLength1

Specifies the length# of the browse request connection character string specified for InConnectionString.

If the browse request connection character string specified for InConnectionString ends with the null terminating character, specify SQL_NTS.

If zero or a negative value is specified, an error results.

OutConnectionString

Specifies a pointer to the buffer that stores the browse result connection character string.

If the connection to the HADB server is successful, the function returns the complete connection character string.

If the function returns SQL_NEED_DATA, it returns the connection attributes that were lacking when connection with the HADB server was attempted.

BufferLength

Specifies the length# of the buffer that stores OutConnectionString.

This length includes the null terminating character. SQL_NTS cannot be specified.

StringLength2Ptr

Specifies a pointer to the buffer that stores the valid length# of the browse result connection character string. This length does not include the null terminating character.

This is the valid length# of the character string that is returned to OutConnectionString.

Important

If the length# of the connection character string stored here is greater than the value of BufferLength without the length# of the null terminating character, the character string stored in OutConnectionString is truncated to the length# equivalent to BufferLength without the null terminating character, and then the null terminating character is added at the end.

#

The length must be in bytes for SQLBrowseConnect and in characters for SQLBrowseConnectW.

(4) Return value

This ODBC function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NEED_DATA, SQL_ERROR, or SQL_INVALID_HANDLE.

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

01004

Character string data was right-truncated

The browse result connection character string could not be stored because the *OutConnectionString buffer was too small (the information was truncated). The length of the untruncated browse result connection character string is stored in the *StringLength2Ptr buffer. The function returns SQL_NEED_DATA.

Y

01S00

Invalid connection string attribute

The browse request connection character string (InConnectionString) contains an invalid attribute keyword. The function returns SQL_NEED_DATA.

The attribute keyword specified in the browse request connection character string (InConnectionString) does not apply to the current connection level. The function returns SQL_NEED_DATA.

Y

01S02

Option value changed

The option value was replaced with a similar value because the HADB ODBC driver does not support the value specified for ValuePtr in SQLSetConnectAttr or SQLSetConnectAttrW. The function returns SQL_SUCCESS_WITH_INFO.

N

01S51

Code replacement occurred during conversion of character encoding

A character code that cannot be converted was detected and then replaced with the specified character. The function returns SQL_SUCCESS_WITH_INFO.

Y

08001

Client unable to establish a connection

The HADB ODBC driver cannot connect to the data source.

N

08002

Connection name in use

--

N

08S01

Communication link failure

N

28000

Invalid authorization specification

The authorization identifier or password specified in the browse request connection character string violates the data source limitations.

Y

5C002

Character encoding conversion error

A character code that cannot be converted was detected.

Y

5C052

Version mismatch error

The versions of the ODBC driver and HADB client are different.

Y

5D001

HADB-specific error

An error occurred on HADB, but a specific SQLSTATE or error message cannot be obtained.

Y

HY000

General error

--

N

HY001

Memory allocation error

N

HY013

Memory management error

The function call could not be processed because the memory object could not be accessed.

N

HY090

Invalid string or buffer length

  • The length of a connection attribute value specified in InConnectionString is invalid.

  • An invalid value (SQL_NTS) was specified in BufferLength.

Y

HYT00

Timeout expired

A login timeout occurred before connection with the data source was completed. The login timeout value can be specified by using SQL_ATTR_LOGIN_TIMEOUT in SQLSetConnectAttr or SQLSetConnectAttrW.

N

HYT01

Connection timeout expired

A connection timeout occurred before the data source responded to the request. The connection timeout value can be specified by using SQL_ATTR_CONNECTION_TIMEOUT in SQLSetConnectAttr or SQLSetConnectAttrW.

N

IM001

Driver does not support this function

--

N

IM002

No data source is found

and

Default driver is not specified

N

IM003

Specified driver could not be loaded

N

IM004

Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

N

IM005

Driver's SQLAllocHandle on SQL_HANDLE_DBC failed

N

IM006

Driver's SQLSetConnectAttr or SQLSetConnectAttrW failed

N

IM009

Unable to load translation DLL

N

IM010

Data source name too long

N

IM011

Driver name too long

N

IM012

DRIVER keyword syntax error

N

Legend:

Y: This SQLSTATE might be returned by the HADB ODBC driver.

N: This SQLSTATE is not returned by the HADB ODBC driver.

--: None

(6) Notes