260 DB2 Deployment Guide
**
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.apdv
.cli.doc/doc/t0007141.html
**
** For example, on Linux x86_64 env:
** gcc -o itso_cliapp -m64 -I/home/db2inst1/sqllib/include \
** -L/home/db2inst1/sqllib/lib64 -ldb2 itso_cliapp.c
**
****************************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <sqlenv.h>
#include <sqlcli1.h>
#include <sqlutil.h>
#define MAX_UID_LENGTH 18
#define MAX_PWD_LENGTH 30
int main(int argc, char *argv[])
{
SQLRETURN cliRC = SQL_SUCCESS;
struct sqlca sqlca;
SQLHANDLE henv; /* environment handle */
SQLHANDLE hdbc; /* connection handle */
char ip[255];
char port[8];
char dbname[SQL_MAX_DSN_LENGTH + 1];
char user[MAX_UID_LENGTH + 1];
char passwd[MAX_PWD_LENGTH + 1];
SQLCHAR message[SQL_MAX_MESSAGE_LENGTH + 1];
SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1];
SQLINTEGER sqlcode;
SQLSMALLINT length;
SQLCHAR connStr[255]; /* connection string */
/* verify the number of arguments */
if( argc != 6 )
{
printf(" ERROR: incorrect command line.\n\t%s hostname port database_name
user password\n", argv[0]);
return 1;
}