简体   繁体   English

如何修复C ++程序以解决数据库连接运行时错误(0xC0000005)?

[英]How to fix c++ program for database connectivity run time error (0xC0000005)?

I wrote c++ program to connect with PostgreSQL database in code blocks and there is no compilation error but it is showing (0xC0000005) run time error.I am using Code Blocks IDE with Mingw compiler. 我写了C ++程序以代码块的形式与PostgreSQL数据库连接,没有编译错误,但显示(0xC0000005)运行时错误。我正在将Code Blocks IDE与Mingw编译器一起使用。 Library files are connected still it is not executing connect function. 库文件仍已连接,但未执行连接功能。 How to fix it if anybody can help? 如果有人可以帮助如何解决?

#include <iostream>
#include <SQLAPI.h>   // main SQLAPI++ header
using namespace std;

int main(int argc, char* argv[])
{
     // create connection object to connect to database 
     SAConnection con;

        cout<<"connecting..\n"; 

It is printing this "connecting" word and if I give something to print in try part then also it is printing but not after the connect function. 它正在打印此“正在连接”的单词,如果我在尝试部分中给出了要打印的内容,那么它也在打印但不在连接功能之后。

    try {
            // connect to database 
    // in this example, it is Oracle, 
    // but can also be Sybase, Informix, DB2 
    // SQLServer, InterBase, SQLBase and ODBC 

    //Calling connect function through object of connection class and passing parameters to it.
             con.Connect("99999",    // database name
                     "postgres",  // user name
                      "9874159891974",  // password
          SA_PostgreSQL_Client); //postgresql Client

    cout<< "We are connected!\n";

        con.Disconnect(); // this is optional
        cout << "We are disconnected!\n";
    }

       catch(SAException & x)
    {    // SAConnection::Rollback() 
    // can also throw an exception 
    // (if a network error for example), 
    // we will be ready 

      cout<<"something went wrong"; // print error message 

                    }
    return 0 ;
}

I hope there is no error in my code, when I build my program there is no compilation error and no warnings it shows. 我希望我的代码中没有错误,当我构建程序时,没有编译错误,也没有警告显示。

ERROR: 错误:

connecting.. Process returned -1073741819 (0xC0000005) execution time : 2.251 s Press any key to continue. 连接。进程返回-1073741819(0xC0000005)执行时间:2.251 s按任意键继续。

*****DEBUGGER******* ***** DEBUGGER *******

Setting breakpoints Debugger name and version: GNU gdb (GDB) 7.9.1 Child process PID: 332 Program received signal SIGSEGV, Segmentation fault. 设置断点调试器名称和版本:GNU gdb(GDB)7.9.1子进程PID:332程序收到信号SIGSEGV,分段故障。 In SAString::Init (this=0x4b9032) at SAString.cpp:517 () 在SAString.:cpp:517()的SAString :: Init(this = 0x4b9032)中

It's beacuse password lenght or because OS sound system. 这是因为密码长度或操作系统声音系统。 Wtf? WTF? Yes! 是! Look: https://www.google.com/search?ie=UTF-8&q=%22-1073741819%22 外观: https//www.google.com/search?ie = UTF-8&q =%22-1073741819%22

Edit 1: in "Csc.exe" exited with code -1073741819 , this answer: 编辑1:在“ Csc.exe”中退出,代码为-1073741819 ,此答案:

" (...) And my problem was... That I had a virus/malware problem, and the faulty module was BITGUARD ! (...)我的问题是...我遇到了病毒/恶意软件问题,而故障模块是BITGUARD!

So if someone has this problem, and goes here searching the solution, I think you must try any free Malware remover program to see if Bitguard should not be your problem ! 因此,如果有人遇到此问题,然后在这里搜索解决方案,我认为您必须尝试使用​​任何免费的恶意软件清除程序,看看Bitguard是否应该不是您的问题! (...) " (...)

and this: 和这个:

When our company changed anti-virus software, an application that had not been touched in months suddenly started having the build error "csc.exe" exited with code -532462766.. 当我们公司更换防病毒软件时,几个月未曾使用过的应用程序突然开始出现生成错误“ csc.exe”,代码为-532462766。

I used our new AV client to scan the bin folder of the application that wouldn't build. 我使用新的AV客户端扫描了无法构建的应用程序的bin文件夹。 The AV client claimed it was infected with W32.Trojan.Genkd. 该AV客户端声称它已感染W32.Trojan.Genkd。 Uninstalling that AV software allowed it to build as usual. 卸载该防病毒软件可使它像往常一样构建。 I think a single file got quarantined, preventing the build. 我认为隔离了一个文件,阻止了构建。

Your options may be these: 您的选择可能是:

disinfect the files (assuming it's an actual infection) unquarantine the "infected" files (assuming it's actually safe) uninstall / disable that AV client change AV software 消毒文件(假定是实际感染)取消隔离“被感染”的文件(假定实际上是安全的)卸载/禁用AV客户端更改AV软件

that prove that the problem may be in SO! 证明问题可能出在SO上! Else, you can try deleting bin and obj folders and then cleaning and rebuilding project. 另外,您可以尝试删除bin和obj文件夹,然后清理和重建项目。

To debug, canmark deploy database in project properties. 要进行调试,可以在项目属性中标记部署数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM