By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,610 Members | 1,697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,610 IT Pros & Developers. It's quick & easy.

How to set application name using sqleseti api call

P: n/a
Hello, all.

DB2 ESE v9.1.3, Windows XP.

I want to change the application name of current connection.
I have wrote such SP using sqleseti api call:
---
#include <sqlenv.h>
#include <sqlcli1.h>
#include <sqlca.h>
#include <sqludf.h>

#ifdef __cplusplus
extern "C"
#endif
SQL_API_RC SQL_API_FN sappname (
SQLUDF_VARCHAR *appname
, SQLUDF_INTEGER *rc
, SQLUDF_NULLIND *appname_ind
, SQLUDF_NULLIND *rc_ind
, SQLUDF_TRAIL_ARGS
, struct sqludf_dbinfo *db_info
)
{
struct sqlca sqlca;
struct sqle_client_info clientAppInfo[1];

unsigned short dbAliasLen;
char dbAlias[SQL_ALIAS_SZ + 1];
/* specify db */
dbAliasLen = db_info->dbnamelen;
strcpy(dbAlias, db_info->dbname);
/* initialize clientAppInfo */
clientAppInfo[0].type = SQLE_CLIENT_INFO_APPLNAME;
clientAppInfo[0].pValue =
(char *)malloc(sizeof(char) *(SQLE_CLIENT_APPLNAME_MAX_LEN + 1));

/* set client app. name */
strcpy(clientAppInfo[0].pValue, appname);
clientAppInfo[0].length = strlen((char *)clientAppInfo[0].pValue);

/* set client information */
sqleseti(dbAliasLen, dbAlias, 1, &clientAppInfo[0], &sqlca);
*rc = sqlca.sqlcode;
*rc_ind = 0;
free(clientAppInfo[0].pValue);
return(0);
}
---
I have set the DB2_ALLOW_FENCED_SETI registry variable to YES.
But event I get sqlca.sqlcode=0 after sqleseti call, it seems that my
application name is unchanged after calling this SP.

My questions are:
Am I doing something wrong?
Is it possible at all to set application name?

Sincerely,
Mark Barinstein.

Sep 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sep 26, 11:59 am, 4.s...@mail.ru wrote:
Hello, all.

DB2 ESE v9.1.3, Windows XP.

I want to change the application name of current connection.
I have wrote such SP using sqleseti api call:
---
#include <sqlenv.h>
#include <sqlcli1.h>
#include <sqlca.h>
#include <sqludf.h>

#ifdef __cplusplus
extern "C"
#endif
SQL_API_RC SQL_API_FN sappname (
SQLUDF_VARCHAR *appname
, SQLUDF_INTEGER *rc
, SQLUDF_NULLIND *appname_ind
, SQLUDF_NULLIND *rc_ind
, SQLUDF_TRAIL_ARGS
, struct sqludf_dbinfo *db_info
)
{
struct sqlca sqlca;
struct sqle_client_info clientAppInfo[1];

unsigned short dbAliasLen;
char dbAlias[SQL_ALIAS_SZ + 1];
/* specify db */
dbAliasLen = db_info->dbnamelen;
strcpy(dbAlias, db_info->dbname);
/* initialize clientAppInfo */
clientAppInfo[0].type = SQLE_CLIENT_INFO_APPLNAME;
clientAppInfo[0].pValue =
(char *)malloc(sizeof(char) *(SQLE_CLIENT_APPLNAME_MAX_LEN + 1));

/* set client app. name */
strcpy(clientAppInfo[0].pValue, appname);
clientAppInfo[0].length = strlen((char *)clientAppInfo[0].pValue);

/* set client information */
sqleseti(dbAliasLen, dbAlias, 1, &clientAppInfo[0], &sqlca);
*rc = sqlca.sqlcode;
*rc_ind = 0;
free(clientAppInfo[0].pValue);
return(0);}

---
I have set the DB2_ALLOW_FENCED_SETI registry variable to YES.
But event I get sqlca.sqlcode=0 after sqleseti call, it seems that my
application name is unchanged after calling this SP.

My questions are:
Am I doing something wrong?
Is it possible at all to set application name?

Sincerely,
Mark Barinstein.
This procedure doesn't change the application name in v9.5 too.
Is it feature?
Or may be I have missed something?
Is it possible to write such procedure at all?

Sincerely,
Mark Barinstein.

Oct 10 '07 #2

P: n/a
On Oct 10, 10:28 am, 4.s...@mail.ru wrote:
On Sep 26, 11:59 am, 4.s...@mail.ru wrote:


Hello, all.
DB2 ESE v9.1.3, Windows XP.
I want to change the application name of current connection.
I have wrote such SP using sqleseti api call:
---
#include <sqlenv.h>
#include <sqlcli1.h>
#include <sqlca.h>
#include <sqludf.h>
#ifdef __cplusplus
extern "C"
#endif
SQL_API_RC SQL_API_FN sappname (
SQLUDF_VARCHAR *appname
, SQLUDF_INTEGER *rc
, SQLUDF_NULLIND *appname_ind
, SQLUDF_NULLIND *rc_ind
, SQLUDF_TRAIL_ARGS
, struct sqludf_dbinfo *db_info
)
{
struct sqlca sqlca;
struct sqle_client_info clientAppInfo[1];
unsigned short dbAliasLen;
char dbAlias[SQL_ALIAS_SZ + 1];
/* specify db */
dbAliasLen = db_info->dbnamelen;
strcpy(dbAlias, db_info->dbname);
/* initialize clientAppInfo */
clientAppInfo[0].type = SQLE_CLIENT_INFO_APPLNAME;
clientAppInfo[0].pValue =
(char *)malloc(sizeof(char) *(SQLE_CLIENT_APPLNAME_MAX_LEN + 1));
/* set client app. name */
strcpy(clientAppInfo[0].pValue, appname);
clientAppInfo[0].length = strlen((char *)clientAppInfo[0].pValue);
/* set client information */
sqleseti(dbAliasLen, dbAlias, 1, &clientAppInfo[0], &sqlca);
*rc = sqlca.sqlcode;
*rc_ind = 0;
free(clientAppInfo[0].pValue);
return(0);}
---
I have set the DB2_ALLOW_FENCED_SETI registry variable to YES.
But event I get sqlca.sqlcode=0 after sqleseti call, it seems that my
application name is unchanged after calling this SP.
My questions are:
Am I doing something wrong?
Is it possible at all to set application name?
Sincerely,
Mark Barinstein.

This procedure doesn't change the application name in v9.5 too.
Is it feature?
Or may be I have missed something?
Is it possible to write such procedure at all?

Sincerely,
Mark Barinstein.- Hide quoted text -

- Show quoted text -
Did you ever figure this out? we would also like to able to use this
feature for version DB2 8.1.10

Mark Thomas

Nov 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.