Unix Technical Forum

embedded sql application fails on Suse (powerPC)

This is a discussion on embedded sql application fails on Suse (powerPC) within the DB2 forums, part of the Database Server Software category; --> Hi, i get the following error when running an embedded sql application on Suse (powerPC): SQL4903N The length of ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 12:45 PM
Vivek
 
Posts: n/a
Default embedded sql application fails on Suse (powerPC)

Hi,

i get the following error when running an embedded sql application on
Suse (powerPC):

SQL4903N The length of parameter "runtime_pid" of function
"sqlastrt_trusted"
is not valid.

Iam running against DB2 V9.1

Is this a known issue ?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 12:45 PM
Tonkuma
 
Posts: n/a
Default Re: embedded sql application fails on Suse (powerPC)

Please shaw us your Procedure and the way to call the procedure.
I suspect that the data type mismatch reside in this isuue.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 12:46 PM
Vivek
 
Posts: n/a
Default Re: embedded sql application fails on Suse (powerPC)

On Jun 12, 2:08 am, Tonkuma <tonk...@jp.ibm.com> wrote:
> 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 asswdsql;
}
else {
EXEC SQL CONNECT TO :dbsql;
}

if (SQLCODE == 0) {
strncpy(Sversion_, sqlca.sqlerrp, 8);
Sversion_[8] = '\0';
strcpy(dbname, databaseEnv);
}
else
{
return FALSE;
}
}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 12:50 PM
Knut Stolze
 
Posts: n/a
Default Re: embedded sql application fails on Suse (powerPC)

Vivek wrote:

> On Jun 12, 2:08 am, Tonkuma <tonk...@jp.ibm.com> wrote:
>> 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;


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 asswdsql;
> }
> else {
> EXEC SQL CONNECT TO :dbsql;
> }
>
> 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);
> }
> else
> {
> return FALSE;
> }
> }


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.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:51 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com