Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Crach while connecting to a database, VS2012

3194571Jun 28 2016 — edited Jun 28 2016

I use oracle client 12c and visual studio 2012 (version 11) x64.

I use the following libraries to build the program:

Linker->Additional dependencies: D:\oracle\client\olshyshk\product\12.1.0\client_1\oci\lib\msvc\vc11\oraocci12.lib;%(AdditionalDependencies)

Runtime library: /MDd (MSVCR110D.dll, MSVCP11D.dll)

I see the same libraries were used to build oraocci12.dll.

However when I build and run the program below, I get null pointer exception:

First-chance exception at 0x7574C54F in oci_performance.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

const string kOracleConnectionString = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = slc01mfc.us.oracle.com)(PORT = 1521)))(CONNECT_DATA=(SID=orcl)))";

Connection* createConnection(Environment* env) {

  try {

     return env->createConnection (kUsername, kPassword, kOracleConnectionString);

  } catch (SQLException& e) {

    cout << e.what();

    //throw e;

  } catch (...) {

     cout << "exception!";

  }

  return nullptr;

}

int main(int argc, char* argv[]) {

  Environment* env = Environment::createEnvironment(Environment::DEFAULT);

  cout << "Connecting..." << endl;

  Connection* connection = env->createConnection(kUsername, kPassword, kOracleConnectionString);

  cout << "Connected!" << endl;

  Environment::terminateEnvironment(env);

  return 0;

}

These are my command line for compiler and linker:

/GS /analyze- /W3 /Zc:wchar_t /I"D:\oracle\client\olshyshk\product\12.1.0\client_1\oci\include" /ZI /Gm /Od /sdl /Fd"Debug\vc110.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"Debug\" /EHsc /nologo /Fo"Debug\" /Fp"Debug\oci_performance.pch"

/OUT:"d:\projects\oci_performance\oci_performance\Debug\oci_performance.exe" /MANIFEST /NXCOMPAT /PDB:"d:\projects\oci_performance\oci_performance\Debug\oci_performance.pdb" /DYNAMICBASE "D:\oracle\client\olshyshk\product\12.1.0\client_1\oci\lib\msvc\vc11\oraocci12.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /INCREMENTAL /PGD:"d:\projects\oci_performance\oci_performance\Debug\oci_performance.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\oci_performance.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"D:\oracle\client\olshyshk\product\12.1.0\client_1\oci\lib\msvc\vc11\" /TLBID:1

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2016
Added on Jun 28 2016
0 comments
861 views