Open System Services ODBC/MX Client Driver (SQL/MX 3.x)

Sample ODBC Application
HP NonStop Open System Services ODBC/MX Client Driver640328-001
A-7
Execution and Testing of Sample ODBC Application
if (hdbc == NULL)
{
printf("Error in allocating connection Handle 1!\n");
odbc_Error(henv,SQL_NULL_HDBC,SQL_NULL_HSTMT);
}
st = SQLAllocConnect(henv, &hdbc1);
if (hdbc1 == NULL)
{
printf("Error in allocating connection Handle 2!\n");
odbc_Error(henv,SQL_NULL_HDBC,SQL_NULL_HSTMT);
}
st = SQLAllocConnect(henv, &hdbc2);
if (hdbc2 == NULL)
{
printf("Error in allocating connection Handle 3!\n");
odbc_Error(henv,SQL_NULL_HDBC,SQL_NULL_HSTMT);
}
st =
SQLConnect(hdbc,(SQLCHAR*)serverName,SQL_NTS,(SQLCHAR*)UserID,SQ
L_NTS,(SQLCHAR*)Password,SQL_NTS);
if (st != SQL_SUCCESS)
{
printf("Error in Connection 1\n");
odbc_Error(henv,hdbc,SQL_NULL_HSTMT);
exit(1);
}
else
printf("Connection 1 Successful\n");
st = SQLSetConnectAttr(hdbc,
SQL_ATTR_TXN_ISOLATION,(SQLPOINTER)8,0);
if (st != SQL_SUCCESS)
{
printf("Error in SQLSetConnectAttr()\n");
odbc_Error(henv,hdbc,hstmt);
}
st =
SQLConnect(hdbc1,(SQLCHAR*)serverName,SQL_NTS,(SQLCHAR*)UserID,S
QL_NTS,(SQLCHAR*)Password,SQL_NTS);
if (st != SQL_SUCCESS)
{
printf("Error in Connection 2\n");
odbc_Error(henv,hdbc,SQL_NULL_HSTMT);
}
else
printf("Connection 2 Successful\n");
Example A-3. Sample ODBC Application Code