> Please shaw us your Procedure and the way to call the procedure.
> I suspect that the data type mismatch reside in this isuue.
This same code works on other platforms. Also this is part of a bigger
application. If i write the exact same code as a small test
application it works fine. I cannot find the difference.
int db2esqlConnect(const char *databaseEnv,
const char *username,
const char *password,
ERRCB *ep)
{
EXEC SQL BEGIN DECLARE SECTION;
char dbsql[10];
char usersql[20];
char passwdsql[20];
short numTables;
EXEC SQL END DECLARE SECTION;
int rc;
long prev_code = 0;
strcpy(dbsql, databaseEnv);
memset(&sqlca, 0, sizeof(struct sqlca));
/* connect to database */
if (username && *username && password && *password) {
strcpy(usersql, username);
strcpy(passwdsql, password);
EXEC SQL CONNECT TO :dbsql USER :usersql USING :passwdsql;
}
else {
EXEC SQL CONNECT TO :dbsql;
}
if (SQLCODE == 0) {
strncpy(Sversion_, sqlca.sqlerrp, 8);
Sversion_[8] = '\0';
strcpy(dbname, databaseEnv);
}
else
{
return FALSE;
}
}
>> Please shaw us your Procedure and the way to call the procedure.
>> I suspect that the data type mismatch reside in this isuue.
[quoted text clipped - 14 lines]
> EXEC SQL END DECLARE SECTION;
> int rc;
I recommend that you initialize _all_ variables at declaration.
> long prev_code = 0;
>
> strcpy(dbsql, databaseEnv);
You should use "strncpy" here to prevent buffer overflows.
> memset(&sqlca, 0, sizeof(struct sqlca));
> /* connect to database */
>
> if (username && *username && password && *password) {
> strcpy(usersql, username);
> strcpy(passwdsql, password);
strncpy
> EXEC SQL CONNECT TO :dbsql USER :usersql USING :passwdsql;
> }
[quoted text clipped - 4 lines]
> if (SQLCODE == 0) {
> strncpy(Sversion_, sqlca.sqlerrp, 8);
What's the definition of Sversion? It does not show up above.
> Sversion_[8] = '\0';
> strcpy(dbname, databaseEnv);
[quoted text clipped - 4 lines]
> }
> }
Other than the above comments, you haven't shown us the code of the
procedure and how you invoke it - just some embedded SQL code that connects
to a database.

Signature
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany