Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2007

Tip: Looking for answers? Try searching our database.

embedded sql application fails on Suse (powerPC)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vivek - 11 Jun 2007 14:20 GMT
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 ?
Tonkuma - 11 Jun 2007 22:08 GMT
Please shaw us your Procedure and the way to call the procedure.
I suspect that the data type mismatch reside in this isuue.
Vivek - 12 Jun 2007 06:38 GMT
> 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;
 }
}
Knut Stolze - 26 Jun 2007 14:22 GMT
>> 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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.