gpt4 book ai didi

c - 连接到数据库的 Pro C 代码给出段错误

转载 作者:行者123 更新时间:2023-11-30 18:05:22 25 4
gpt4 key购买 nike

我的 .pc 文件中有以下代码,该代码被近 10 个进程调用,但对于其中一个进程,它无法正常工作,显示“核心转储/段错误”。这是每个进程调用的代码,作为连接数据库的第一步。请指出以下代码中的问题出在哪里-:

void DatabaseLogon (void)
{
EXEC SQL BEGIN DECLARE SECTION;
char *pchORALOG="";
EXEC SQL END DECLARE SECTION;

EXEC SQL WHENEVER SQLERROR DO SQLError();

/* Save text of current SQL statement in the ORACA if an error occurs. */

oraca.orastxtf = ORASTFERR;

/* try to get the oracle login user/pass at the process level */
if ( (pchORALOG=getenv("oralog")) == NULL )
{
printf("Error:Cannot Logon to database!\n");
SQLError();
}
else
{
EXEC SQL CONNECT :pchORALOG;
}
} /* End Of DatabaseLogon */

谢谢阿尔皮塔

最佳答案

我的 ProC 连接语句如下所示:
EXEC SQL CONNECT:用户识别:密码:数据库;

关于c - 连接到数据库的 Pro C 代码给出段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6504919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com