Re: core dump using Pro*C on CONNECT

From: Frank Diedrich <fdi_at_gmx.de>
Date: Sat, 26 Jul 2003 12:57:33 +0200
Message-ID: <bftmrb$dot$01$1_at_news.t-online.com>


[Quoted] "thumor" <member34030_at_dbforums.com> schrieb im Newsbeitrag news:3148847.1059070191_at_dbforums.com...
>
> Line of code in my Pro*C file:
>
> <--BEGIN-->
>
> strcpy(Username, user_id);
> strcpy(Userpass, user_pw);
> strcpy(DBname, db_name);
>
> strcat(Username, '\0');
> strcat(Userpass, '\0');
> strcat(DBname, '\0');
>
>
> EXEC SQL CONNECT :Username IDENTIFIED BY :Userpass AT DB_NAME
> USING :DBname;
>
>
> if (sqlca.sqlcode != 0)
> {
> sprintf(Log_Msg, "Error %d (%s) Connecting Database
> ",sqlca.sqlcode,sqlca.sqlerrm);
> Log_Message(Waste_Log, "pods_init", FATAL, Log_Msg);
> }
> else
> {
> sprintf(Log_Msg, "Connection to Database Successful");
> Log_Message(Waste_Log, "pods_init", INFORM, Log_Msg);
> };
> <--- End -->
>
> I am running on HP-UX 10.2, ORACLE = 8.0.5
>
> I get core dumped on me after the CONNECT statement.
>
> What seems to be the problem?
> Please help.
>
> --
> Posted via http://dbforums.com

Hello,

[Quoted] i had the same problems in coding with C. Try to use char in C and then use the variable type declaration to declare the variable as string. With this method, you don't need to get the length of the char-array all the time (like with VARCHAR). See documentation for correct use.

Greetings,

Frank Received on Sat Jul 26 2003 - 12:57:33 CEST

Original text of this message