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

0

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. 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.

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

Setting breakpoints Debugger name and version: GNU gdb (GDB) 7.9.1 Child process PID: 332 Program received signal SIGSEGV, Segmentation fault. In SAString::Init (this=0x4b9032) at SAString.cpp:517 ()

c++
postgresql
codeblocks
asked on Stack Overflow Jul 30, 2019 by piya • edited Jul 31, 2019 by piya

1 Answer

-1

It's beacuse password lenght or because OS sound system. Wtf? Yes! Look: https://www.google.com/search?ie=UTF-8&q=%22-1073741819%22

Edit 1: in "Csc.exe" exited with code -1073741819 , this answer:

"(...) And my problem was... That I had a virus/malware problem, and the faulty module was 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 ! (...)"

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..

I used our new AV client to scan the bin folder of the application that wouldn't build. The AV client claimed it was infected with 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

that prove that the problem may be in S.O! Else, you can try deleting bin and obj folders and then cleaning and rebuilding project.

To debug, canmark deploy database in project properties.

answered on Stack Overflow Jul 30, 2019 by Giuliano • edited Jul 30, 2019 by Giuliano

User contributions licensed under CC BY-SA 3.0